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 to the user telling them they need to turn on the .NET Framework.

I've never heard that the .NET Framework could be turned off. You need a better description of the situation, maybe from the customer.
–
John SaundersApr 19 '10 at 18:37

2

I always thought (assumed) that doing this was the same as uninstalling.
–
dkackmanApr 19 '10 at 18:37

1

@John, @dkackman. Turning off a feature in Windows 7 does not uninstall the feature, it is simply turned off or disabled.
–
Chris TaylorApr 19 '10 at 18:41

@Chris: he also didn't say Windows 7. Added to the tags.
–
John SaundersApr 19 '10 at 18:42

3

It would be nice if the CLR loader would detect this state and give a friendly indication that "This application cannot run because you have disabled the .NET Framework feature. Please 'click here' to manage your enabled features." Then again, I had always hoped for something similar on failing to resolve dependent assemblies...
–
Dan BryantApr 19 '10 at 19:10

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)