开发者

How to check version of .NET install on the computer

I am writing a WPF C# Desktop app, and I want to check if the client computer has .NET installed before running the application.

How to check what version of .NET has been installed on the c开发者_Go百科lient computer? Or, is it possible?


Checking if the right .NET version is installed is not the job of your application, because if it isn't installed, your application won't start in the first place.

You should create an installer that does the checking. The setup project you can create in Visual Studio does this by default.


There seem to be a couple of methods:

  • You could check the registry - How to determine which versions and service pack levels of the Microsoft .NET Framework are installed (KB)
  • You could also check the installation directories Programmatically determine .NET framework version


Your .NET app won't run without the right Framework installed and they'll get an error. You can include .NET Framework redistributable as part of your installation to ensure user has Framework installed when they run your app.


You can check it in the setup installer. A WPF application can't run on a computer without .NET.


ClickOnce has some features to help with this.

When you publish your application, it'll allow you to specify what dependencies you have, including the .NET framework. If the dependencies are missing, the ClickOnce setup will install them before running the application.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜