【发布时间】:2018-02-03 06:39:34
【问题描述】:
问题
由于“
,我的构建不断失败C:\Program Files (x86)\MSBuild\14.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1820):无法解析此引用。找不到程序集“Newtonsoft.Json,Version=10.0.0.0,Culture=neutral,PublicKeyToken=30ad4fe6b2a6aeed,processorArchitecture=MSIL”。检查以确保该程序集存在于磁盘上。如果您的代码需要此引用,则可能会出现编译错误。
我花了很多时间试图解决这个问题,但我一无所获。任何形式的帮助将不胜感激!
当我 RDP 进入我的构建服务器并浏览构建的包文件夹时,NewtonSoft.Json 不存在。出于某种原因,它没有被下载,但是,当我在本地计算机上构建它时,它下载得很好。
我尝试过的:
- 我已检查源代码管理中不存在包文件夹
- 我已将 nuget.exe 升级到最新版本 (4.3.0),然后降级回 3.4.4(这次升级破坏了一切)
- 我已删除构建服务器上的 builds 文件夹
- 我检查了我的 web 配置文件,其中包含:
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
- 我检查了我的 .csproj 文件,其中包含:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
- 我检查了我的 NuGet.Config 文件,其中包含:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="NuGet.Org Ver 3" value="https://api.nuget.org/v3/index.json" />
<add key="NuGet official package source" value="https://nuget.org/api/v2/" />
</packageSources>
<disabledPackageSources />
</configuration>
- 我检查了我的 packages.config 文件,其中包含:
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
我正在运行 Visual Studio 2015 Update 3
构建服务器是 TFS 2013
已解决(但我不应该这样做,很不对劲) 我通过简单地将 NewtonSoft.Json 降级到 9.0.1 解决了这个问题
【问题讨论】:
-
这里的体验完全相同,降级是唯一的解决办法。
标签: tfsbuild nuget-package-restore