.Net: chicken and eggs?

There are several options for C # -based programs to determine which version of .Net is installed. But is it possible to determine if .Net IS is installed? I mean, if I run a C # program on a machine without any .Net installation, I get the following error:


Myprogram.exe - Application Error

The application failed to initialize correctly (0xc0000135). Click OK to terminate the application.

Ok

Yes, I can write a wrapper (some external program or msi package or something like that), but I wonder if I can make this sanity check from my C # program? All I want to do is check for .Net and fail with the correct warning, for example, “Microsoft.Net is required. Install it bla-bla-bla”.

Any clue? Thanks.

+3
source share
4 answers

I think the preferred way to do this is to create an installer for your application and make the .NET Framework a prerequisite that the installer checks.

You can also enable the Re-distributable.Net Framework components so that your installer installs it if it is not found.

See this question for more information .

+10
source

If you create the ClickOnce installer and add the .NEt version that you need as a prerequisite, then this check will be performed for you when your users first install your program.

+4
source

, # .NET. , , , .

You need to write your own code to verify this, or, more preferably, the installer who checks this.

+4
source

You can use the Bootstrapper plugin and the structure will be bundled with your application.

+1
source

Source: https://habr.com/ru/post/1724121/


All Articles