Visual studio VSTS负载测试无法找到程序集
我已经编写了负载测试,如果在本地运行,它可以正常工作。但是,当它们被配置为在云中运行时。我得到以下错误 无法加载文件或程序集Newtonsoft.json 6.0.0 我正在使用Visual studio 2017 15.7.4 目前,我在项目中引用了newtonsoft.json 11.0.2,这是我的package.config文件Visual studio VSTS负载测试无法找到程序集,visual-studio,binding,azure-devops,load-testing,Visual Studio,Binding,Azure Devops,Load Testing,我已经编写了负载测试,如果在本地运行,它可以正常工作。但是,当它们被配置为在云中运行时。我得到以下错误 无法加载文件或程序集Newtonsoft.json 6.0.0 我正在使用Visual studio 2017 15.7.4 目前,我在项目中引用了newtonsoft.json 11.0.2,这是我的package.config文件 <?xml version="1.0" encoding="utf-8"?> <packages> <packa
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Dapper" version="1.50.5" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.6"
targetFramework="net461" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461"
/>
<package id="System.Security.Cryptography.Algorithms" version="4.3.1"
targetFramework="net461" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0"
targetFramework="net461" />
<package id="System.Security.Cryptography.Primitives"
version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.X509Certificates"
version="4.3.2" targetFramework="net461" />
</packages>
这里还有安装nuget软件包后默认添加到app.config中的程序集绑定
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System" publicKeyToken="b77a5c561934e089"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml" publicKeyToken="b77a5c561934e089"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data" publicKeyToken="b77a5c561934e089"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json"
publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
所有引用也标记为“CopyLocal”true
不确定是什么原因造成的。任何线索都会很好。对于任何遇到这一点的人。这很奇怪,但看起来像 System.Net.Http.Formatting(使用Microsoft.AspNet.WebAPI.Client 5.2.6安装) 和Newtonsoft.Json(11.0.2)彼此不兼容(单独部署到云端时) 当我使用HttpClient.PostAsJsonAsync()时,我的代码被破坏了
我只是简单地删除了System.Net.Http.Formatting dll,并使用了使用httpclient.PostAsync的更长版本的代码,现在它似乎工作正常 您的一个项目或程序集/nuget包似乎仍在引用较旧版本的
Newtonsoft.Json
nuget包。检查您是否在解决方案中使用该nuget包的不同版本,以及解决方案中每个项目的引用。这是一个独立的项目,不依赖于解决方案中的任何其他项目。该项目中的某个位置必须存在其他仍在引用v6.0的依赖项。0@MandarJogalekar尝试卸载Newtonsoft.Json包,然后重新安装,看看是否可以重现此问题。另外,尝试在另一台计算机上运行项目(不要复制包),以检查是否会出现相同的错误。已卸载并安装newtonsoft.json。它不起作用。此外,负载测试在云上运行,因此我的本地机器可以有效地将文件上传到云上。对吗?