【问题标题】:CICD TFS 2013 - Nuget auto restore on TFS Serer buildCI CD TFS 2013 - TFS 服务器构建上的 Nuget 自动恢复
【发布时间】:2021-04-04 23:26:18
【问题描述】:

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

我在解决方案文件夹中添加了 NuGet.config 文件。但是在 TFS Build 上自动恢复 NuGet 它不起作用。

错误:

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.

【问题讨论】:

  • 您能否更好地格式化您的问题 - 以便将错误代码与您的文本分开?现在很难阅读。
  • 这个问题怎么样?下面的答案是否解决了您的问题,如果是,您可以Accept it as an Answer,这样它可以帮助遇到相同问题的其他社区成员,我们可以存档这个帖子,谢谢。

标签: tfs nuget


【解决方案1】:

CICD TFS 2013 - 在 TFS Serer 构建上自动恢复 Nuget

根据错误信息,表明您在项目中使用了Newtonsoft.Json, Version=12.0.0.0

AFAIK,从Newtonsoft.Json 9.0.1开始,这个包支持目标框架.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

【讨论】:

  • 不工作:我说的是在 tfs server 2013 上自动构建。不在视觉工作室中。
猜你喜欢
  • 2015-04-26
  • 2014-04-01
  • 2014-11-12
  • 2011-04-30
  • 2015-11-14
  • 2014-12-22
  • 2015-08-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多