我真的很喜欢 nuget 并在 Visual Studio Team Services (visualstudio.com) 下构建解决方案。任何帮助都感激不尽。
我有一个包含 36 个项目的解决方案。许多项目使用相同的 5 或 6 个 nuget 包。我已仔细遵循迁移 MSBuild 集成解决方案以使用自动包还原的说明,因此在我的解决方案文件夹下有一个 .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?如果 Automatic Package Restore 建议删除,Visual Studio Team Services 甚至应该如何使用 NuGet ~/.nuget/NuGet.exe
?
在此先感谢,克里斯