生成VB.Net应用程序和程序集警告

生成VB.Net应用程序和程序集警告,vb.net,Vb.net,使用VS 2017。Net应用程序 如果我进行完整编译,会收到如下警告: 1> Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsof

使用VS 2017。Net应用程序

如果我进行完整编译,会收到如下警告:

1>  Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Net.Http.dll] to Version "4.1.1.1" [D:\My Programs\2017\MeetSchedAssist\packages\System.Net.Http.4.3.2\lib\net46\System.Net.Http.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "9.0.0.0" [] to Version "10.0.0.0" [D:\My Programs\2017\MeetSchedAssist\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll] to solve conflict and get rid of warning.


1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2042,5): warning MSB3836: The explicit binding redirect on "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" conflicts with an autogenerated binding redirect. Consider removing it from the application configuration file or disabling autogenerated binding redirects. The build will replace it with: "<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" xmlns="urn:schemas-microsoft-com:asm.v1" />".
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2042,5): warning MSB3836: The explicit binding redirect on "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" conflicts with an autogenerated binding redirect. Consider removing it from the application configuration file or disabling autogenerated binding redirects. The build will replace it with: "<bindingRedirect oldVersion="0.0.0.0-4.1.1.1" newVersion="4.1.1.1" xmlns="urn:schemas-microsoft-com:asm.v1" />".
那么,是否建议将这两个文件完全删除?

很可能您正在引用的System.Net.Http和Newtonsoft.Json与您的应用程序所依赖的.Net版本不匹配。尝试从app.config文件中删除绑定重定向。这可能会在下次构建时解决问题

更新

根据错误消息中的建议,您可以执行以下操作:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
    </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.1.1.1" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

将两个程序集的版本分别更改为10.0.0.0和4.1.1.1。我最初的建议是删除感谢您的评论。请看我的最新问题,因为我想确保我理解你的建议。或者你可以用解决问题所需的方法来充实你的答案?提前谢谢。我已经看了你的评论,并相应地编辑了我的答案。希望有帮助。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
    </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.1.1.1" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>