NuGet Package Restore is not restoring packages on build

这一生的挚爱 提交于 2019-12-03 11:33:54
CodeWarrior

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!