开发者

Is it possible to compile a .NET 2 WinForms application to run on .NET 4, if no .NET 2 is installed?

开发者 https://www.devze.com 2023-02-20 06:54 出处:网络
Recently I got a customer complaint, that a small .NET 2.0 application I wrote did not run on his Windows 7 computer.

Recently I got a customer complaint, that a small .NET 2.0 application I wrote did not run on his Windows 7 computer.

After investigating, I found out that there was no folder c:\Windows\Microsoft.NET\Framework\v2.0.50开发者_JAVA技巧727 on his machine, just the folder for V4.0.

I was unaware that such a constellation is even possible.

My question:

Is it somehow possible to instruct my application to use the .NET 4 runtime, if no .NET 2 runtime is found on a client machine?


I think you're looking for the <supportedRuntime> element in app.config.

So for example, you can write an app.config file of:

<configuration>
   <startup>
      <supportedRuntime version="v2.0.50727"/>
      <supportedRuntime version="v4.0"/>
   </startup>
</configuration>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号