开发者

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

Let's say, I have a .NET 2 installed. Can I programmatically install version 4 us开发者_开发技巧ing .NET 2?


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:

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

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


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.


Sure. Just start the installer process.

Process.Start("dotnetfx.exe");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜