Problems Building .Net Core on TFS
<p>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.</p>
<p>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 &quot;Build solution&quot; step with the error message</p>
<blockquote>
<p>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.</p>
<p>Please run &quot;dotnet restore&quot; to generate a new lock file. [C:\TFSBuildAgent_work\6\s\MyProject\MyProject.xproj]</p>
</blockquote>
<p><br>So I go ahead and create a PowerShell script with the content <code>dotnet restore</code> that I run before &quot;Build solution&quot; but after &quot;Nuget restore&quot;. This also fails, this time on step &quot;Dotnet restore&quot; with the error message</p>
<blockquote>
<p>Errors in C:\TFSBuildAgent_work\6\s\MyProject\project.json</p>
<p>Unable to resolve 'ProjectDependency (&gt;= 1.0.0)' for '.NETFramework,Version=v4.6.1'.</p>
</blockquote>
<p><br>When I run <code>dotnet restore</code> on my local machine, it completes without any issues.</p>
<p>Any help or hints are greatly appreciated!</p>