1
votes

I have a solution containing multiple .Net Core projects, some of which are dependent on other projects in the same solution. The whole solution is hosted in a Git repository of an on-premises TFS server.

I want to set up an automated build process on the TFS server. For lack of better knowledge, I use the Visual Studio build template and leave all the settings on their defaults. When I run the build process, it fails on the "Build solution" step with the error message

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): error : Project MyProject does not have a lock file.

Please run "dotnet restore" to generate a new lock file. [C:\TFSBuildAgent_work\6\s\MyProject\MyProject.xproj]


So I go ahead and create a PowerShell script with the content dotnet restore that I run before "Build solution" but after "Nuget restore". This also fails, this time on step "Dotnet restore" with the error message

Errors in C:\TFSBuildAgent_work\6\s\MyProject\project.json

Unable to resolve 'ProjectDependency (>= 1.0.0)' for '.NETFramework,Version=v4.6.1'.


When I run dotnet restore on my local machine, it completes without any issues.

Any help or hints are greatly appreciated!

1
If you have multiple projects in your solution, you need to run dotnet restore for each of them. Also, try deleting project.json.lock file on your local machine and re-run dotnet restore just for testing. Do you have the same .NET and .NET Core framework versions installed on both machines? - Ignas
dotnet --info gives 1.0.0-preview2-003131 for the CLI tools on both machines, the .Net framework versions are the same too. dotnet restore steps into all subfolders. I deleted the .lock.json file, dotnet restore still works on my local machine. - Thaoden
you can do dotnet --verbose restore... to get more detailed output - DaveShaw
I helped myself now in packaging the project dependency and uploading it to my inhouse package server. dotnet restore will then pull it from the server and build the whole project. Not the nicest way, but at least it's working. - Thaoden

1 Answers

1
votes

I helped myself now in packaging the project dependency and uploading it to my inhouse package server. dotnet restore will then pull it from the server and build the whole project. Not the nicest way, but at least it's working.