Nuget Get-Project -All在哪里? Add-BindingRedirect获取其版本号? [英] Where does the Nuget Get-Project -All | Add-BindingRedirect get its version numbers?

查看:118
本文介绍了Nuget Get-Project -All在哪里? Add-BindingRedirect获取其版本号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将解决方案中的所有DLL版本与许多项目同步.我注意到我的app.config包含多个程序集绑定重定向,如下所示:

I'm trying to synchronize all of the DLL versions in my solution with many projects. I noted that my app.config contains several assembly binding redirects like so:

  <dependentAssembly>
    <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
  </dependentAssembly>

但是,据我所知,通过NuGet软件包管理器可以看出,没有需要合并的软件包,并且所有项目都指向该程序集的4.4.1版

However, as best I can tell via the NuGet package manager, there are no packages that need consolidation and all projects point to version 4.4.1 of that assembly

我尝试遵循

I tried folowing the advice of this blog post. I deleted all of the binding redirects and attempted to regenerate via:

获取项目-全部| Add-BindingRedirect

Get-Project -All | Add-BindingRedirect

根据 NuGet文档 Add-BindingRedirect应该检查项目的输出路径.我假设这意味着bin文件夹.

According to the NuGet Documentation Add-BindingRedirect should check the projects output path. I am assuming this means the bin folder.

但是在清理和重建Get-Project -All | Add-BindingRedirect之后,仍然会在我的app.config中产生相同的重定向.

But after cleaning and rebuilding Get-Project -All | Add-BindingRedirect still produces the same redirects in my app.config.

NuGet Get-Project -All | Add-BindingRedirect在哪里获得其版本号?

Where does the NuGet Get-Project -All | Add-BindingRedirect get its version numbers?

这些不正确的NuGet软件包版本可能从哪里来?

And where might these incorrect NuGet Package Versions be coming from?

推荐答案

看看这篇文章

从Visual Studio 2013开始,面向.NET Framework 4.5.1的新桌面应用程序将使用自动绑定重定向.这意味着,如果两个组件引用同一强命名程序集的不同版本,则运行时会在输出应用程序配置(app.config)文件中自动向该程序集的较新版本添加绑定重定向.此重定向优先于否则可能发生的程序集统一.源app.config文件未修改.例如,假设您的应用程序直接引用带外.NET Framework组件,但使用了针对同一组件的较旧版本的第三方库.编译应用程序时,将修改输出应用程序配置文件以包含到组件的较新版本的绑定重定向.如果创建Web应用程序,则会收到有关绑定冲突的构建警告,从而使您可以选择将必要的绑定重定向添加到源Web配置文件中.

Starting with Visual Studio 2013, new desktop apps that target the .NET Framework 4.5.1 use automatic binding redirection. This means that if two components reference different versions of the same strong-named assembly, the runtime automatically adds a binding redirection to the newer version of the assembly in the output app configuration (app.config) file. This redirection overrides the assembly unification that might otherwise take place. The source app.config file is not modified. For example, let's say that your app directly references an out-of-band .NET Framework component but uses a third-party library that targets an older version of the same component. When you compile the app, the output app configuration file is modified to contain a binding redirection to the newer version of the component. If you create a web app, you receive a build warning regarding the binding conflict, which in turn, gives you the option to add the necessary binding redirect to the source web configuration file.

来源:单击此处以了解更多关于绑定信息

这篇关于Nuget Get-Project -All在哪里? Add-BindingRedirect获取其版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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