简体   繁体   English

CICD TFS 2013 - Nuget 在 TFS Serer 版本上自动恢复

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

CICD TFS 2013 - Nuget auto restores on TFS Serer MSbuild(not in Visual Studio): CICD TFS 2013 - Nuget 在 TFS Serer MSbuild 上自动恢复(不在 Visual Studio 中):

I added NuGet.config file on a solution folder.我在解决方案文件夹中添加了 NuGet.config 文件。 but auto restores NuGet on TFS Build it's not worked.但在 TFS 上自动恢复 NuGet 构建它不起作用。

Error:错误:

enter image description here在此处输入图像描述

$/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 auto restore on TFS Serer build CICD TFS 2013 - Nuget 在 TFS Serer 版本上自动恢复

According to the error message, it shows you have use the Newtonsoft.Json, Version=12.0.0.0 in your project.根据错误消息,它表明您在项目中使用了Newtonsoft.Json, Version=12.0.0.0

AFAIK, starting from Newtonsoft.Json 9.0.1 , this package supports the targets framework .NETStandard : AFAIK,从Newtonsoft.Json 9.0.1开始,这个 package 支持目标框架.NETStandard

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

在此处输入图像描述

Which is supported by NuGet 2.12 . NuGet 2.12支持。

So, to resolve this issue, you should make sure the nuget.exe version is higher than 2.12 and the Visual Studio version is high than 2013 .因此,要解决此问题,您应确保 nuget.exe 版本高于2.12并且Visual Studio 版本高于 2013

To resolve this issue, you could update Visual Studio 2013 to Visual Studio 2015 and above, then use MSBuild task to specify the MSBuild 14.0 (or above) to build your project.要解决此问题,您可以将 Visual Studio 2013 更新到 Visual Studio 2015 及更高版本,然后使用 MSBuild 任务指定 MSBuild 14.0(或更高版本)来构建您的项目。

Or you could use the Newtonsoft.Json 8.0.3 instead of 12.0.x in your projects.或者,您可以在项目中使用Newtonsoft.Json 8.0.3而不是12.0.x

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM