代码之家  ›  专栏  ›  技术社区  ›  sirdank ben

为什么Visual Studio要为程序集重定向创建app.configs?

  •  1
  • sirdank ben  · 技术社区  · 8 年前

    我有大约100个项目的解决方案。我不知道是什么触发了它,但是Visual Studio偶尔会在我的每个项目中添加app.config。通常是这样的:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.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>
    

    据我所知,不需要这些app.config文件。如果我恢复所有这些更改并删除app.config文件,一切都会正常工作。为什么Visual Studio要这样做?如何使其停止?

    1 回复  |  直到 8 年前
        1
  •  0
  •   olegk    8 年前

      <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>
    

    推荐文章