在code,而不是大会的app.config重定向而不是、重定向、大会、code

由网友(一季烟雨凉)分享简介:我用IronRuby的执行加载程序集与需要从V2.0.0.0重定向到v3.5.0.0像这样在app.config依赖的脚本:I'm using ironruby to execute a script that loads an assembly with a dependency that needs to be...

我用IronRuby的执行加载程序集与需要从V2.0.0.0重定向到v3.5.0.0像这样在app.config依赖的脚本:

I'm using ironruby to execute a script that loads an assembly with a dependency that needs to be redirected from v2.0.0.0 to v3.5.0.0 in the app.config like this:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="3.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.CompactFramework.Build.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="9.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="3.5.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
</runtime> 

该脚本的工作原理与此重定向,但是这需要我随时更改IronRuby的app.config中,它适用于所有的脚本。 我需要:

The script works with this redirection, but this requires me to always change the ironruby app.config, and it applies to all scripts. I need to either:

定义此重定向无论是对一个脚本 执行code是注册重定向要求有问题的装配前

如何?

推荐答案

您可以通过避免使用,我写所谓的黑客改变了IronRuby 的app.config configuration_settings_hackery.rb 。您可以读到它的在我的博客。该博客帖子包含一个链接到GitHub上一个要点。

You can avoid changing the IronRuby app.config by using a hack that I wrote called configuration_settings_hackery.rb. You can read about it on my blog. The blog post contains a link to a gist on github.

我使用这个技巧的每一天,我一直有很多与它的成功。您将需要更改 configuration_settings_hackery.rb 文件的最后一行指向的位置,你的的app.config 。我发布的版本只是看起来对 C:的app.config

I use this hack every day, and I have been having a lot of success with it. You will need to change the last line of the configuration_settings_hackery.rb file to point to the location of your app.config. The version that I posted just looks for c:app.config.

阅读全文

相关推荐

最新文章