VSTS负载测试无法找到组件

时间:2018-08-01 12:08:53

标签: 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>
    <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”。

不知道是什么原因造成的。任何线索都很好。

1 个答案:

答案 0 :(得分:0)

对于遇到此问题的任何人。很奇怪,但是看起来像。

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的更长版本的代码,现在看来还可以!

相关问题