【发布时间】:2014-06-12 00:06:58
【问题描述】:
我真的很喜欢 nuget 并在 Visual Studio Team Services (visualstudio.com) 下构建解决方案。任何帮助将不胜感激。
我有一个包含 36 个项目的解决方案。许多项目使用相同的 5 或 6 个 nuget 包。我已仔细遵循Migrating MSBuild-Integrated solutions to use Automatic Package Restore 的说明,因此在我的解决方案文件夹下有一个 .nuget 文件夹,其中包含唯一的 NuGet.Config 文件,不再包含 Nuget.exe 或 Nuget.targets 文件。所有项目的 Nuget.targets 行都已删除。
我正在使用 Visual Studio 2013 Professional (v12 Update 2),解决方案在本地构建,没有错误或警告。即使在清理和删除包文件夹之后,它也可以正常下载和构建。包文件夹未检入 Visual Studio Team Services。
检查构建日志表明:
- nuget 在构建开始时没有启动以检查、下载和解压缩任何未解析的包(它在从 MSBuild-Integrated 迁移到自动包还原之前执行此操作 - 但是尽管如此,它不是能够解析引用)
- 我留下了 113 个错误,主要围绕项目无法解析引用这一事实。
- 与本地构建(和 MSBuild 集成)不同,Visual Studio Team Services 现在甚至不会在其构建日志中提及 nuget!!!
事情开始失败的日志示例(尽管这显然是因为 nuget 没有介入):
Project "C:\a\src\TFS\RSPlatform\Main\Source\RSPlatform Team Project.sln" (1) is building "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\A2Refresh.csproj" (8) on node 1 (default targets).
PrepareForBuild:
Creating directory "obj\Release\".
ResolveAssemblyReferences:
Primary reference "Bytescout.Spreadsheet".
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Bytescout.Spreadsheet". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\A2Refresh.csproj]
For SearchPath "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies".
Considered "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies\Bytescout.Spreadsheet.winmd", but it didn't exist.
Considered "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies\Bytescout.Spreadsheet.dll", but it didn't exist.
Considered "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies\Bytescout.Spreadsheet.exe", but it didn't exist.
For SearchPath "{HintPathFromItem}".
Considered "..\..\packages\Bytescout.Spreadsheet.2.4.0.1346\lib\net45\Bytescout.Spreadsheet.dll", but it didn't exist.
For SearchPath "{TargetFrameworkDirectory}".
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Bytescout.Spreadsheet.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Bytescout.Spreadsheet.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Bytescout.Spreadsheet.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\Bytescout.Spreadsheet.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\Bytescout.Spreadsheet.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\Bytescout.Spreadsheet.exe", but it didn't exist.
For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.5.1,AssemblyFoldersEx}".
Considered AssemblyFoldersEx locations.
For SearchPath "{AssemblyFolders}".
谁能建议我应该如何让 Visual Studio Team Services 使用 nuget?
如果自动包还原建议删除 ~/.nuget/NuGet.exe,Visual Studio Team Services 甚至应该如何使用 NuGet?
提前致谢, 克里斯
【问题讨论】:
-
你有没有想过这个问题?我在这方面进行了大约 12 个小时的反复试验,但没有运气。答案中的链接说 VSO 的默认工作流应该已经处理了这个问题,但我已经打开它们并确认没有实现 nuget 包还原。
-
嗨,松饼人,我没有。 @probackpacker 的响应确实有助于让 nuget 启动并执行包还原过程,但是,当它继续构建解决方案/项目时,相关项目仍然无法找到程序集。查看我的日志文件(6 月 26 日 9:09)了解我的进度。
-
这是不好的。与您的 30 多个项目相比,我的设置要简单得多,但我仍然可以重现这种愚蠢的不当行为!我有一个带有一个 (1!) 文件的控制台应用程序,Program.cs。一切都很好,直到我从 NuGet 添加任何东西 - 我尝试了 EF 和 nUnit。然后——噗!什么都没有了。我认为这不是不可能解决的,只是 MS 的一个非常愚蠢的设置。有什么提示吗?
标签: visual-studio-2013 azure-devops nuget-package-restore