2017-08-16 21 views
0

我在csproj文件中使用PackageReferences的新nuget机制。 使用瞬态解析时,不会在app.config中创建BindingRedirections。NuGet:临时解析中的特定版本 - >绑定重定向

例如:

我安装System.Reactive 3.1.1与的csproj新的NuGet格式。 Nuget不创建绑定重定向。 我尝试了PackageManagerConsole中的Add-BindingRedirect,但没有任何反应。

当我使用旧的格式(packages.config)的NuGet创建以下绑定重定向

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
<dependentAssembly> 
    <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> 
    <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> 
</dependentAssembly> 
</assemblyBinding> 

下一个问题是:为什么只有1个重定向? System.Reactive取决于多个nugets,但其中一个只有重定向?

有人可以向我解释这个吗? 在此先感谢

拉尔斯

回答

0

的想法是绑定重定向不会添加到源App.config但在构建过程中产生的,所以你得到的Foo.exe.config应该取决于依赖闭合所需的绑定重定向。

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> 
+0

谢谢,我会看看生成的配置文件:

这是通过使用PackageReference是典型的项目自动设置一个属性控制 – GibSral