gpt4 book ai didi

c# - Nuget 在多个项目中创建 app.config 文件

转载 作者:行者123 更新时间:2023-11-30 12:23:21 36 4
gpt4 key购买 nike

我开始在我的解决方案中使用 Nuget 在某些项目中安装 Owin 和其他一些依赖项。我在这里阅读有关 Nuget 和 app.config 文件的信息

Why NuGet adds app.config with assemblyBinding to LIBRARY projects during a NuGet package update?

在这里

https://msdn.microsoft.com/en-us/library/7wd6ex19.aspx

现在我知道为什么要使用它们,绑定(bind)特定版本等等......

我遇到的问题是,我有一个包含 32 个项目的大型解决方案。

如果我在项目 C 中安装 Owin。项目 A、B、D、F 中会出现一个 app.config 文件,其中包含以下信息。

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin"
publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

为什么我会收到这个?这些项目没有使用 OWIN。有什么办法可以避免这种情况吗?或者也许不使用 nuget 手动安装它?

谢谢。

P.S: 我用的是VS2015企业版

编辑:

我们拥有的架构如下。我有安装了 Owin 的项目 WebApi。该项目被项目连接器引用。该项目连接器和所有引用它的项目都具有以前的 app.config 文件。那是对的吗?如果他们不使用 OWIN,为什么有必要这样做?

编辑2:

我使用 VS2015 中的 nuget 包管理器从我的解决方案中卸载了所有 nuget 包,这些具有依赖项的文件仍然存在。

最佳答案

我建议信任 NuGet 并保留它所做的 app.config 更改(khellang explained why),但如果它真的让你烦恼,你可以skip applying binding redirects

关于c# - Nuget 在多个项目中创建 app.config 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37319171/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com