在.NET 4的配置是什么“useLegacyV2RuntimeActivati​​onPolicy'呢? [英] What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config?

查看:196
本文介绍了在.NET 4的配置是什么“useLegacyV2RuntimeActivati​​onPolicy'呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然转换所用SlimDX一个项目,因此具有非托管code,以.NET 4.0我遇到了以下错误:

  

混合模式组件构建针对运行时的版本V2.0.50727',不能在4.0运行时无需附加配置信息加载。

周围的Googling给我的解决方案,这是将它添加到应用程序配置:

 <结构>
  <启动useLegacyV2RuntimeActivati​​onPolicy =真正的>
    < supportedRuntime版本=V4.0/>
  < /启动>
< /结构>
 

我的问题是,什么是 useLegacyV2RuntimeActivati​​onPolicy 在做什么?我找不到它的任何文件。

解决方案

在一些时间(及以上搜索),我发现<一href="http://blogs.msdn.com/jomo%5Ffisher/archive/2009/11/17/f-scripting-net-4-0-and-mixed-mode-assemblies.aspx">this博客条目通过乔莫·费舍尔。

  

一,我们已经看到了最近出现的问题是因为并排端运行时的支持是,.NET 4.0已改变了其绑定到旧的混合模式组件的方式。这些组件是,例如,那些在C ++ \ CLI编译。目前可用的DirectX组件是混合模式。如果你看到这样的信息,那么你知道你遇到了这个问题:

     

混合模式组件构建针对运行时的版本V1.1.4322',不能在4.0运行时无需附加配置信息加载。

     

[剪断]

     

有关应用程序的好消息是,你必须回落到.NET 2.0时代,这些组件通过设置一个app.config标志,像这样绑定选项:

 &LT;启动useLegacyV2RuntimeActivati​​onPolicy =真正的&GT;
  &LT; supportedRuntime版本=V4.0/&GT;
&LT; /启动&GT;
 

因此​​,它看起来喜欢的方式运行时负载的混合模式组件发生了变化。我找不到任何细节这一变化,或者为什么做。但 useLegacyV2RuntimeActivati​​onPolicy 属性恢复为CLR 2.0加载。

While converting a project that used SlimDX, and therefore has unmanaged code, to .NET 4.0 I ran into the following error:

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

Googling around gave me the solution, which is to add this to the applications config:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>

My question is, what is the useLegacyV2RuntimeActivationPolicy doing? I can't find any documentation about it.

解决方案

After a bit of time (and more searching), I found this blog entry by Jomo Fisher.

One of the recent problems we’ve seen is that, because of the support for side-by-side runtimes, .NET 4.0 has changed the way that it binds to older mixed-mode assemblies. These assemblies are, for example, those that are compiled from C++\CLI. Currently available DirectX assemblies are mixed mode. If you see a message like this then you know you have run into the issue:

Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

[Snip]

The good news for applications is that you have the option of falling back to .NET 2.0 era binding for these assemblies by setting an app.config flag like so:

<startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0"/>
</startup>

So it looks like the way the runtime loads mixed-mode assemblies has changed. I can't find any details about this change, or why it was done. But the useLegacyV2RuntimeActivationPolicy attribute reverts back to CLR 2.0 loading.

这篇关于在.NET 4的配置是什么“useLegacyV2RuntimeActivati​​onPolicy'呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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