2017-12-27 114 views
0

我有问题将我的便携式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。安装。

+0

您的构建是否包含NuGet还原或您的MSbuid呼叫?包含'/ restore'参数? –

+0

@MartinUllrich我们将NuGet安装程序任务设置为NuGet 3.0.0版。将其更改为4.0.0可以解决问题。 –

回答

1

请使用最新的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.

  1. 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.
  2. For your NuGet/NuGet Installer step, use the version selector under the task name to select version “0.*”.
  3. In the Advanced section, set the NuGet Version to “Custom” and the Path to NuGet.exe as $(Build.BinariesDirectory)\nuget.exe
  4. 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.

参考以下主题:

+0

@ToreØstergaard你是否解决了这个问题?任何更新? –

+0

我们在NuGet版本3.3.0的版本中设置了NuGet Installer任务。将其更改为4.0.0解决了该版本的问题。我目前正在调查另一个版本中似乎没有使用NuGet Installer任务的类似问题。 –