如何运行CLR 2应用程序作为CLR 4应用程序 [英] How to run CLR 2 application as CLR 4 application
问题描述
可以说,我有一个旧的应用程序,它会试图加载外部组件。
- 在旧的应用程序被编译为CLR 2。
- 新的组件编译为CLR 4。
我希望能够运行老应用程序内部CLR 4。我记得有一些的 XML清单魔术的参与。
我怎样才能创建清单xml文件告诉oldapplication.exe应在CLR 4运行?
我发现了一些建议,但他们似乎并没有为我工作。
- <一个href="http://geekswithblogs.net/technetbytes/archive/2007/06/01/112928.aspx">http://www.mibuso.com/forum/viewtopic.php?f=23&t=33840&view=next
- <一个href="http://geekswithblogs.net/technetbytes/archive/2007/06/01/112928.aspx">http://geekswithblogs.net/technetbytes/archive/2007/06/01/112928.aspx
- <一个href="http://msdn.microsoft.com/en-us/library/a5dzwzc9.aspx">http://msdn.microsoft.com/en-us/library/a5dzwzc9.aspx
oldapplication.exe.config:
&LT; XML版本=1.0&GT?;
&lt;结构&GT;
&LT;启动&GT;
&LT;! - 设置相应的.NET版本 - &GT;
&LT; requiredRuntime版本=4.0.0.0/&GT;
&LT; /启动&GT;
&LT; /结构&gt;
同时给予再出手,我发现这个文件,以作为我的模板:
C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.20506 \ Aspnet_regsql.exe.config
&LT; XML版本=1.0&GT?;
&lt;结构&GT;
&LT;启动&GT;
&LT; supportedRuntime版本=v4.0.20506/&GT;
&LT; requiredRuntime版本=v4.0.20506安全模式=真/&GT;
&LT; /启动&GT;
&LT; /结构&gt;
我还更新了code至报告当前CLR:
Console.WriteLine(typeof运算(对象).Assembly.ImageRuntimeVersion);
它的工作原理吧!
您需要提供正确的版本号。请注意,这是公测版本1,它会改变,直到RTM落户之一:
&lt;结构&GT;
&LT;启动&GT;
&LT; supportRuntime版本=4.0.20506/&GT;
&LT; /启动&GT;
&LT; /结构&gt;
Lets say I have an old application which will try to load an external assembly.
- The old application is compiled to CLR 2.
- The new assembly is compiled to CLR 4.
I would like to be able to run that old application inside CLR 4. I remember there was some xml manifest magic involved.
How can I create that manifest xml file to tell that oldapplication.exe shall run under CLR 4?
I found some suggestions, but they do not seem to work for me.
- http://www.mibuso.com/forum/viewtopic.php?f=23&t=33840&view=next
- http://geekswithblogs.net/technetbytes/archive/2007/06/01/112928.aspx
- http://msdn.microsoft.com/en-us/library/a5dzwzc9.aspx
oldapplication.exe.config:
<?xml version ="1.0"?>
<configuration>
<startup>
<!--set the appropriate .net version-->
<requiredRuntime version="4.0.0.0"/>
</startup>
</configuration>
While giving another shot i found this file to serve as my template:
C:\Windows\Microsoft.NET\Framework\v4.0.20506\Aspnet_regsql.exe.config
<?xml version ="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0.20506"/>
<requiredRuntime version="v4.0.20506" safemode="true"/>
</startup>
</configuration>
I also updated the code to report current CLR:
Console.WriteLine(typeof(object).Assembly.ImageRuntimeVersion);
It works now!
You need to give the proper version number. Note that this is the beta 1 version, it will change until RTM settles one:
<configuration>
<startup>
<supportRuntime version="4.0.20506"/>
</startup>
</configuration>
这篇关于如何运行CLR 2应用程序作为CLR 4应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!