将便携式转换为.Net标准本地构建但不使用团队构建
我有问题将我的便携式C#项目转换为.Net标准2.0。将便携式转换为.Net标准本地构建但不使用团队构建
我遵循Adam Pedley在Upgrade PCL to .NET Standard Class Library中概述的方法,最后让所有的东西在本地工作。然而,我们构建服务器上排队时,我面临着以下错误:
C:\Program Files\dotnet\sdk\2.0.3\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file 'D:\Builds\Agent-57-01_work\11\s\MyProject\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [D:\Builds\Agent-57-01_work\11\s\MyProject\MyProject.csproj]
我们构建服务器运行的代理版本2.120.2,并有Visual Studio的15.4.5。安装。
回答:
请使用最新的NuGet(您可以尝试Nuget版本4.3.0)来恢复软件包。
如果您使用的是VSTS,那么您可以使用NuGet工具安装程序来安装Nuget版本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.
参考以下主题:
- Use VSTS to build a solution with VSTS Packages and old style csproj
- NuGet Restore task fails for .Net Core project migrated with VS 2017
以上是 将便携式转换为.Net标准本地构建但不使用团队构建 的全部内容, 来源链接: utcz.com/qa/265646.html