NuGet Package Restore is not restoring packages on build

前端 未结 2 1812
野趣味
野趣味 2021-02-14 01:57

I am moving our source code from Vault to TFS, not bothering with the migration or anything, just pulling a get latest in vault and adding it to TFS.

The solution has go

相关标签:
2条回答
  • 2021-02-14 02:27

    This answer needs to be considered with the others. In my case, Visual Studio decided not to add the packages.config automatically into Source Control. Hence the file did not make it's way through to the build server for consideration during Nuget restore.

    0 讨论(0)
  • 2021-02-14 02:42

    I figured it out, and I found the answer here: MSBuild not running BuildDependsOn tasks from an imported project

    The problem (after looking through the Diagnostic verbosity build output) was that the BuildDependsOn setting was getting un-set. My project files each had the import statement

    <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
    

    but that statement was at the beginning of the XML tree. Apparently the import for Microsoft.CSharp.targets can interfere with that import and thus the BuildDependsOn.

    My solution was to move the nuget.targets import to below the Microsoft.CSharp.targets import. Now everything builds beautifully.

    0 讨论(0)
提交回复
热议问题