How do i know if my solution was running against .Net Framework1.1 or .Net Framework2.0?

angel_lee 2006-05-16 10:52:26
After I installed .Net Framework2.0 on Windows2003 Server, How do i know if my solution was running against .Net Framework1.1 or .Net Framework2.0?
Since Win2003 Server has default configuration .Net Framework1.1.

I know for asp.net we may use asp_regiis.exe to register a new version .Net Framework, what should I use for Winform solutions?

Do I have any posibility to uninstall .Net Framework1.1 on Win2003 Server?

Notes: My solution can run against both .Net Framework1.1 and .Net Framework2.0


...全文
400 23 打赏 收藏 转发到动态 举报
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
sx_lxh 2006-05-31
  • 打赏
  • 举报
回复
我觉得Knight94(愚翁)说的有道理。
limengqiang 2006-05-31
  • 打赏
  • 举报
回复
恭喜发财,把分抢来!!,哎,现在大家都在说鸟语了,发个帖子都是E文,可怜的汉字啊!!
代码蜗牛sky 2006-05-31
  • 打赏
  • 举报
回复
Look at this:
http://msdn2.microsoft.com/en-us/library/9w519wzk.aspx

I think is of help to you^_^

flyfootball 2006-05-31
  • 打赏
  • 举报
回复
The system should choose .Net Framework version authomaticly.you can use 2.0 complier rebuild you system,so your system should be run the .Net Framework 2.0
lextm 2006-05-31
  • 打赏
  • 举报
回复
From my own experience, a .NET 1.1 compiled console/gui executable can be running on both .NET 1.1 and .NET 2.0.

When I install .NET 2.0 on WinXP, I find it sets itself the default framework of the Windows. Unless a config file used indicates loading .NET 1.1, clicking the exe file loads .NET 2.0.

I think your case should be similar. When you install .NET 2.0 on Win2003, the default framework should be .NET 2.0, although .NET 1.1 is still there.
angel_lee 2006-05-25
  • 打赏
  • 举报
回复
Hi qqchen79(知秋一叶)

my solution is not asp.net, it's a winform solution. So I don't have application config file in my solution. Could you please tell me where should I put the runtime version setting code?

Thanks!
qqchen79 2006-05-19
  • 打赏
  • 举报
回复
It should be 1.1 in this case.
Check which version of the mscoree.dll is loaded in the process memory space using VS.NET may give you an idea.

As I said, for testing purpose, setting the CLR version in config file is the simplest way.
ilovejolly 2006-05-19
  • 打赏
  • 举报
回复
mark
  • 打赏
  • 举报
回复
这么多说E文的,看来都是经常在国外论坛混的老手了,COZ,COZ的,就是我看着费劲,这么多中文贴,冷不丁来了E文,头大.
不过还是学习了!
angel_lee 2006-05-19
  • 打赏
  • 举报
回复
Thanks a lot qqchen79(Phantom Of Autumn)!

First, my solution was compiled against .Net framework1.1

Second, my solution will run against both 1.1 and 2.0, since it will run against a cluster which maybe have 1000 machines with different OS and .Net Framework.

So I want to test my solution against different CLR without do any specific set for it.

Currently, my solution works proper against Win2kSev/.Net Framework1.1, Win2kSev/.Net Framework2.0, Win2k3Sev/.Net Framework1.1.
I've installed .Net Framework2.0 against Win2003 Server. But I am not sure if my solution was running against .Net Framework2.0. Since 1.1 and 2.0 available on Win2003 Server together. Do you have any idea for it?

Thanks!
qqchen79 2006-05-18
  • 打赏
  • 举报
回复
First, you need to decide which version of the framework your application is going to be compiled against. I assume this would be 2.0 cause you have a better chance for backward compatibility with 2.0.

Second, you need to verify which version of the framework is your application running against. If both 1.1 and 2.0 are available, 2.0 will be loaded cause that's the version your application compiled against. You CANNOT change CLR version in your application because CLR is loaded before any of your code gets executed. You can write an unmanaged c++ host for CLR but that's over complicated.

The simple work around is the config file approach I mentioned previously. Compile you application, then run it on a machine with both 1.1 and 2.0. Change requiredRuntime to both 1.1 versio of the CLR and 2.0 version of the CLR, verify your application works fine on both. There is no change in code.
曲滨_銘龘鶽 2006-05-17
  • 打赏
  • 举报
回复
鸟语挺多,就是没花香

bs 你们这些说鸟语的 ^_^ 我们要保护本国语言
从小开始...... ^_^
angel_lee 2006-05-17
  • 打赏
  • 举报
回复
Thanks wangsaokui(无间道III(终极无间))

To make the question clear, for example I want to run my solution against Win2003 Server/.Net Framework2.0 without changing my codes. But Win2003 Server has default installed .Net Framework1.1. How can I make sure that my solution was running against 2.0.

My solution can support both 1.1 and 2.0. I don't want to add any limitation for CLR version in my codes.

Thanks!
angel_lee 2006-05-17
  • 打赏
  • 举报
回复
Thanks so much qqchen79(Phantom Of Autumn) and division(好风长吟) !

Actually, my solution can run against both 1.1 and 2.0 without setting application config file.

But I hope I may exchange the .Net framework run time through command line without changing any codes in my solution if my machine have already installed both 1.1 and 2.0. What should I do? Do you know any command or .exe file that may realize it?
angel_lee 2006-05-17
  • 打赏
  • 举报
回复
althrough my solution support both 1.1 and 2.0, but I need to verified that it can works proper in both of the environment.

It will use default framework if I do not specific setting the framework. Currently I need to know the test results for both of the two framework.

Thanks!
Knight94 2006-05-17
  • 打赏
  • 举报
回复
If your solution is able to be run under 1.1 and 2.0, why should you care about what current environment it is?

As my experience, I installed both vs2003 and vs2005 in my computer before.
The program, no matter about it was wrote in 1.1 or 2.0, can be run in my computer.

But as its deliveried to other computers, you should install the proper environment for it. That is:
If it is wrote in 1.1, pls install 1.1 framework;
else install 2.0 framework.
wangsaokui 2006-05-16
  • 打赏
  • 举报
回复
https://www.netscum.dk/china/technet/community/scriptcenter/resources/hey0712.mspx
wangsaokui 2006-05-16
  • 打赏
  • 举报
回复
Visual Studio 2005 调试器支持调试 .NET Framework 的早期版本和当前的 2.0 版。如果您从 Visual Studio 启动应用程序,调试器可以始终为正在进行调试的应用程序识别 .NET Framework 的正确版本。如果应用程序已正在运行并且您使用了“附加到”选项,则调试器可能无法始终识别 .NET Framework 的早期版本。如果发生这种情况,您将收到一条错误信息,指出:

调试器对应用程序要使用的 Microsoft .NET Framework 版本进行了不正确的假定。

在这些不常见的情况下,您可设置注册表项以指示调试器要使用的版本。

指定用于调试的 .NET Framework 版本
在 Windows\Microsoft.NET\Framework 目录中查找您计算机上安装的 .NET Framework 的版本。这些版本号类似于:

V1.1.4322

识别正确的版本号并记录下来。

启动“注册表编辑器”(regedit)。

在“注册表编辑器”中打开 HKEY_LOCAL_MACHINE 文件夹。

定位到:HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\8.0\AD7Metrics\Engine\{449EC4CC-30D2-4032-9256-EE18EB41B62B}

如果该项不存在,请右击 HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\8.0\AD7Metrics\Engine,然后在快捷菜单中单击“新建项”。将新项命名为 {449EC4CC-30D2-4032-9256-EE18EB41B62B}。

定位到 {449EC4CC-30D2-4032-9256-EE18EB41B62B} 后,在“名称”列中查找 CLRVersionForDebugging 项。

如果该项不存在,请右击 {449EC4CC-30D2-4032-9256-EE18EB41B62B},然后在快捷菜单中单击“新建字符串值”。然后右击该新建字符串值,单击“重命名”,并键入 CLRVersionForDebugging。

双击“CLRVersionForDebugging”。

在“编辑字符串”框中,在“值”框中键入 .NET Framework 版本号。例如:V1.1.4322

单击“确定”。

关闭“注册表编辑器”。

如果开始调试时仍然收到错误信息,请验证是否已在注册表中正确输入了版本号。还请验证您是否正在使用 Visual Studio 支持的 .NET Framework 版本。调试器与 .NET Framework 2.0 版及早期版本兼容,但可能与未来的版本不向前兼容。
qqchen79 2006-05-16
  • 打赏
  • 举报
回复
1. Use Environment.Version to determine the version you are currently using.

2. By default, application binds to the CLR version it was built with (If your app was built with 1.1, it binds to 1.1 even if 2.0 is present).

3. This behavior can be overridden in application config file. For example:
<?xml version="1.0" ?>
<configuration>
<startup>
<requiredRuntime version="Vx.x.xxxx" safemode="true"/>
</startup>
</configuration>

4. I can't believe Saucer is still contributing here.... :)
aSalt 2006-05-16
  • 打赏
  • 举报
回复
I know for asp.net we may use asp_regiis.exe to register a new version .Net Framework, what should I use for Winform solutions?

winform should reference dlls and compiler:
type csc /? for c sharp compiler help
加载更多回复(3)

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧