将便携式转换为 .Net Standard 在本地构建但不使用 Team Build
Converting portable to .Net Standard builds locally but not using Team Build
我在将 Portable C# 项目转换为 .Net Standard 2.0 时遇到问题。
我遵循了 Adam Pedley 在 Upgrade PCL to .NET Standard Class Library 中概述的方法,并最终在本地完成了所有工作。但是,在我们的构建服务器上排队时,我遇到了以下错误:
C:\Program Files\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file 'D:\Builds\Agent-57-01_work\s\MyProject\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [D:\Builds\Agent-57-01_work\s\MyProject\MyProject.csproj]
我们的构建服务器是 运行 代理版本 2.120.2 和 Visual Studio 15.4.5。安装。
请使用最新的NuGet(可以试试Nuget Version 4.3.0)来恢复包。
如果您使用的是 VSTS,那么您可以使用 NuGet Tool Installer 安装 Nuget Version 4.3.0。
对于本地 TFS,只需遵循以下解决方法:(有关详细信息,请参阅 Using the latest NuGet in your build。)
Because the NuGet Tool Installer is not available in TFS versions
prior to TFS 2018, there is a recommended workaround to use versions
of NuGet > 4.0.0 in Team Build.
- Add the task, if you haven’t already. If you have a “NuGet Restore”
step in the catalog (it may be in the Deprecated tasks section),
insert it into your build. Otherwise, insert a “NuGet” step.
- For your
NuGet/NuGet Installer step, use the version selector under the task
name to select version “0.*”.
- In the Advanced section, set the NuGet
Version to “Custom” and the Path to NuGet.exe as
$(Build.BinariesDirectory)\nuget.exe
- Before your NuGet step, add a
“PowerShell” step, select “Inline Script” as the Type, enter this
PowerShell script as the Inline Script, and enter “4.3.0” (or any
version of NuGet from this list) as the Arguments.
另请参考以下主题:
我在将 Portable C# 项目转换为 .Net Standard 2.0 时遇到问题。
我遵循了 Adam Pedley 在 Upgrade PCL to .NET Standard Class Library 中概述的方法,并最终在本地完成了所有工作。但是,在我们的构建服务器上排队时,我遇到了以下错误:
C:\Program Files\dotnet\sdk.0.3\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file 'D:\Builds\Agent-57-01_work\s\MyProject\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [D:\Builds\Agent-57-01_work\s\MyProject\MyProject.csproj]
我们的构建服务器是 运行 代理版本 2.120.2 和 Visual Studio 15.4.5。安装。
请使用最新的NuGet(可以试试Nuget Version 4.3.0)来恢复包。
如果您使用的是 VSTS,那么您可以使用 NuGet Tool Installer 安装 Nuget Version 4.3.0。
对于本地 TFS,只需遵循以下解决方法:(有关详细信息,请参阅 Using the latest NuGet in your build。)
Because the NuGet Tool Installer is not available in TFS versions prior to TFS 2018, there is a recommended workaround to use versions of NuGet > 4.0.0 in Team Build.
- Add the task, if you haven’t already. If you have a “NuGet Restore” step in the catalog (it may be in the Deprecated tasks section), insert it into your build. Otherwise, insert a “NuGet” step.
- For your NuGet/NuGet Installer step, use the version selector under the task name to select version “0.*”.
- In the Advanced section, set the NuGet Version to “Custom” and the Path to NuGet.exe as $(Build.BinariesDirectory)\nuget.exe
- Before your NuGet step, add a “PowerShell” step, select “Inline Script” as the Type, enter this PowerShell script as the Inline Script, and enter “4.3.0” (or any version of NuGet from this list) as the Arguments.
另请参考以下主题: