为什么 NuGet 在 NuGet 包更新期间将带有 assemblyBinding 的 app.config 添加到 LIBRARY 项目? [英] Why NuGet adds app.config with assemblyBinding to LIBRARY projects during a NuGet package update?

查看:9
本文介绍了为什么 NuGet 在 NuGet 包更新期间将带有 assemblyBinding 的 app.config 添加到 LIBRARY 项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

难道这些信息仅在可执行文件的项目中是必需的吗?

Isn't this information necessary only in the executable's project?

如何禁用此文件创建?

NuGet 2.8

编辑

库项目在 NuGet 2.7 中是例外,通过修复此问题在 2.8 中改变了行为:http://nuget.codeplex.com/workitem/3827 提交:https://github.com/NuGet/NuGet2/commit/448652d028e3f01ba4022e147baaf4e1fb3f969b

Library projects were exceptions in NuGet 2.7, behavior changed in 2.8 by fixing this issue: http://nuget.codeplex.com/workitem/3827 with commit: https://github.com/NuGet/NuGet2/commit/448652d028e3f01ba4022e147baaf4e1fb3f969b

推荐答案

程序集绑定重定向在类库中与在可执行项目中一样有效.

Assembly binding redirects are as valid in a class library as they are in executable projects.

考虑一下;在构建应用程序时,编译器如何知道要使用哪个版本的引用程序集(对于类库)?

Think about this; when building your application, how will the compiler know which version of referenced assemblies to use (for the class libraries)?

在没有重定向的情况下,这通常可以正常工作,但是当您偶然发现具有 GAC 版本的程序集的机器时,您可能会遇到麻烦.

Often this will work just fine, without the redirects, but when you stumble over a machine that has a GAC'ed version of the assembly, you could get into trouble.

我建议您阅读 程序集绑定重定向文档 以更好地了解它是什么,做什么.

I suggest you read the assembly binding redirect documentation to better understand what it is and does.

NuGet 添加了带有重定向功能的 app.config 来帮助您,坦率地说,我不知道额外的 app.config 是否可以让一切按预期工作.

NuGet adds the app.config with redirects to help you, and quite frankly, I don't get the fuzz about an extra app.config for everything to work as expected.

从今天开始,它将为所有项目添加重定向,但以下类型除外:

As of today, it will add redirects to all projects, except the following types:

  • WiX
  • JS
  • 内梅勒
  • C++
  • Synergex
  • Visual Studio
  • Windows 应用商店应用

据我所知,没有办法关闭它.如果这是一个问题,你可以在 Github 上创建一个问题.

As far as I know, there's no way of turning this off. You could create an issue at Github if this is a problem.

添加程序集绑定重定向的源代码可以找到这里.

The source code for adding assembly binding redirects can be found here.

这篇关于为什么 NuGet 在 NuGet 包更新期间将带有 assemblyBinding 的 app.config 添加到 LIBRARY 项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆