簡體   English   中英

CICD TFS 2013 - Nuget 在 TFS Serer 版本上自動恢復

[英]CICD TFS 2013 - Nuget auto restore on TFS Serer build

CICD TFS 2013 - Nuget 在 TFS Serer MSbuild 上自動恢復(不在 Visual Studio 中):

我在解決方案文件夾中添加了 NuGet.config 文件。 但在 TFS 上自動恢復 NuGet 構建它不起作用。

錯誤:

在此處輸入圖像描述

$/Core/testCICD/Webtest/Webtest.sln - 5 error(s), 1 warning(s), View Log File
 Default.aspx.cs (8): The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
 Default.aspx.cs (9): The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
 Model\Account.cs (1): The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
 Model\Account.cs (12): The type or namespace name 'JsonProperty' could not be found (are you missing a using directive or an assembly reference?)
 Model\Account.cs (12): The type or namespace name 'JsonPropertyAttribute' could not be found (are you missing a using directive or an assembly reference?)
 C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

CICD TFS 2013 - Nuget 在 TFS Serer 版本上自動恢復

根據錯誤消息,它表明您在項目中使用了Newtonsoft.Json, Version=12.0.0.0

AFAIK,從Newtonsoft.Json 9.0.1開始,這個 package 支持目標框架.NETStandard

https://www.nuget.org/packages/Newtonsoft.Json/9.0.1

在此處輸入圖像描述

NuGet 2.12支持。

因此,要解決此問題,您應確保 nuget.exe 版本高於2.12並且Visual Studio 版本高於 2013

要解決此問題,您可以將 Visual Studio 2013 更新到 Visual Studio 2015 及更高版本,然后使用 MSBuild 任務指定 MSBuild 14.0(或更高版本)來構建您的項目。

或者,您可以在項目中使用Newtonsoft.Json 8.0.3而不是12.0.x

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM