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

查看:37
本文介绍了为什么 NuGet 在 NuGet 包更新期间将 app.config 和 assemblyBinding 添加到 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
  • 视觉工作室
  • 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 包更新期间将 app.config 和 assemblyBinding 添加到 LIBRARY 项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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