开发者

How can I detect when the .NET Framework feature is "turned off" in Windows 7 / Vista?

开发者 https://www.devze.com 2022-12-27 15:57 出处:网络
My application requires the .NET Framework version 3.5.I recently ran into a customer that had the .NET Framework installed but turned off on Windows Vista (also applies to Windows 7).

My application requires the .NET Framework version 3.5. I recently ran into a customer that had the .NET Framework installed but turned off on Windows Vista (also applies to Windows 7).

In this case, my installer (InstallShield 2009) does not prompt the user to install the Framework (because it is already installed) and when my application runs it crashes immediately. I tried another .NET application and it also crashes immediately.

Is there any way to detect this situation and handle it more gracefully? Just detecting this during install is not ideal since the .NET Framework can be turned off at any time. Ideally, the application would be able to check and display a friendly message开发者_StackOverflow社区 to the user telling them they need to turn on the .NET Framework.

EDIT: "Turning off" the .NET Framework in Windows Vista or Windows 7 is not the same as uninstalling it. The Framework can be simply turned back on without reinstalling: http://windows.microsoft.com/en-US/windows-vista/Turn-Windows-features-on-or-off


When I turned off the feature, the value in the registry that indicated the framework is installed got deleted. You could check that value.

Take a look at: HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5


Looks like you're going to write a non-managed launcher for your app. Roll up your sleeves and have a nice C++ dive :)


Woot, I think this URL might have your answer:

http://blogs.msdn.com/astebner/archive/2008/04/04/8358995.aspx

See "How to install the .NET Framework 3.0 OS component in a deployment scenario". It describes using ocsetup to trigger Windows to turn the feature on, as far as I can tell. Best of luck.

Also, I'm curious if ClickOnce installers are intelligent to know if the feature is turned off (I imagine they would be). But since you're using InstallShield you probably want a more fully-featured installer than clickonce ;o)

0

精彩评论

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