Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I programmatically install new version of .NET using .NET?

Tags:

c#

Let's say, I have a .NET 2 installed. Can I programmatically install version 4 using .NET 2?

like image 594
kofucii Avatar asked Sep 28 '10 20:09

kofucii


3 Answers

Of course you can. Include the required installation package and then Process.Start, or even better: make a setup and deployment project for your application and set a launch condition to .NET 4.0 so that when someone tries to install it it will verify the presence of .NET 4.0 and if not ask to install it:

alt text

Remark: in the screenshot set .NET 4.0 as launch condition (step 4)

like image 108
Darin Dimitrov Avatar answered Oct 23 '22 10:10

Darin Dimitrov


You can do this (just shell out to installer MSI and msiexec.exe), but there are things like lock downs and other security issues to consider. But it's better practise to tell the user to install it and then install your program. Your installer will need to be .net 2.0 code to do this.

like image 43
Preet Sangha Avatar answered Oct 23 '22 12:10

Preet Sangha


Sure. Just start the installer process.

Process.Start("dotnetfx.exe");
like image 1
JaredPar Avatar answered Oct 23 '22 11:10

JaredPar