【发布时间】:2015-08-17 16:50:35
【问题描述】:
我正在尝试使用 MSBuild 扩展在 Jenkins 上构建解决方案。我已将解决方案从 VS 2013 迁移到 VS 2015。为了能够在 Visual Studio 2015 中恢复 NuGet 包,我必须按照此处的建议删除 .nuget 文件夹:http://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore。
现在的问题是 MSBuild 需要 .nuget 文件夹才能恢复 nuget 包。
Build FAILED.
"E:\_JENKINS\workspace\Project1 - Deploy DEVELOP to BuildServer\Solution1\Build\Build.proj" (DeployTarget target) (1) ->
E:\_JENKINS\workspace\Project1 - Deploy DEVELOP to BuildServer\Solution1\Build\Build.proj(50,5):
error MSB4019: The imported project "E:\_JENKINS\workspace\Project1 - Deploy DEVELOP to BuildServer\Solution1\.nuget\NuGet.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
0 Warning(s)
1 Error(s)
我把事情搞混了吗?我做错了什么吗?
因为只有一个有效:MSBuild 或 Studio Package Restore。
所以要么我将包文件夹添加到 git,要么通过命令行恢复或 MSBuild 恢复替换解决方案中的自动恢复。但无论如何,这两种解决方案似乎都是错误的。
【问题讨论】:
-
只需从项目文件 (csproj) 中删除对该目标文件的引用,然后在编译前使用
nuget restore solution.sln恢复包。 NuGet 文档有更多关于这种迁移的信息。
标签: jenkins msbuild visual-studio-2015 nuget-package-restore