开发者

How to check for versions of .NET from registry?

I want to check if .Net 2.0 or greater is installed on the machine. I want to check i开发者_JS百科n a way that when newer versions are released the old code works. Registry check is ideal as the code is in C++.


This blog post should have all the information you need: Link


Reading your question quite literally, I would suggest a bootstrapper which does the check, and then launches your .Net app.

Why? Because if your .Net app relies on a specific .Net version (example 3.0), and there is only v2.0 installed on the machine, then your app will crash. If you have a native bootstrapper .exe then you can check the registry using the WinAPI (thousands of examples already exist for this), then launch your .Net app.

An alternative is to check with a bootstrapper that relies only on .Net 2.0 - that version is fairly ubiquitous these days, the chances of a correctly patched and updated machine not having it are fairly small (the chances are greater if it is a pre-WinXP machine). Later versions of the .Net framework are backward compatable with v2.0 (although i am unsure if the reduced nature of the 4.0 CP framework still makes it fully compatable with v2.0).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜