【发布时间】:2018-02-04 10:34:50
【问题描述】:
我有一个可以使用 Visual Studio 正确构建的 ASP.NET Core 项目,但它不能在 MSBuild 下构建。
它没有找到所有的通用库(系统等)。
我正在使用 TeamCity,构建过程的一部分是 nuget restore。
我尝试执行与 TeamCity 相同的步骤,但使用 MSBuild 手动执行,但失败了,找不到库。
我添加了一个dotnet restore 步骤,然后它起作用了。
那么,nuget restore 和 dotnet restore 有什么区别?
【问题讨论】:
-
我怀疑由于 dotnet restore 有效,但 nuget 没有,Team City 上的 nuget 是不了解 PackageReferences 的旧版本。 NuGet 至少需要 4.0 版。
-
我们遇到了同样的问题,dotnet restore 有效,但 nuget restore 无效。对我们来说,这发生在 TeamCity 和本地。
-
事情对我来说更奇怪。
nuget restore告诉我它无法解析单个包。如果我然后使用dotnet restore它会下载一些包,但是我的msbuild由于缺少包仍然无法编译解决方案。如果我然后再次执行nuget restore,它会突然找到所有内容,然后随后的msbuild可以工作......显然,我的项目中的包配置方式发生了一些非常奇怪的事情。
标签: .net msbuild nuget teamcity