Click to See Complete Forum and Search --> : Catching ".NET framework not found" exception? How do I do it?


intermario_gr
January 27th, 2008, 12:28 PM
Hey people,

I was just wondering if my .NET based application could detect the presence of the 2.0 Framework on the computer it is running from before actually loading the main form and all (i.e. from the main entry point Main()). I am developing a let's-say-semi-professional-project and without the framework installed on the machine, a rather strange and not so informative message from Microsoft comes up which is rather vague (can't remember the exact words). Is there any way I could catch this exception?


Thanks.

TheCPUWizard
January 27th, 2008, 12:32 PM
Best bet is to do it with a small peice of native c++ code. If you atempt to do it from manaed code your options are REALLY limited (since the framework is not installed/available).

dglienna
January 27th, 2008, 01:07 PM
Try this:

http://blogs.msdn.com/robvi/archive/2004/02/17/75272.aspx

intermario_gr
January 27th, 2008, 04:27 PM
Try this:

http://blogs.msdn.com/robvi/archive/2004/02/17/75272.aspx


Thanks, it's pretty much what I need but wouldn't I still have to use C++ unmanaged code to perform this check? I already have the framework installed so it's difficult to try it out.

dglienna
January 27th, 2008, 04:39 PM
Or scripting. Whatever you are comfortable in, except .Net :)

intermario_gr
January 27th, 2008, 07:23 PM
I found out about the Visual Studio 2005 Bootstrapper which can deploy your application after checking if all prerequisites have been installed on the target machine.
This is a very satisfactory solution to my problem but hey.. has anybody used this thing? I've just deployed my application and it's generated the setup.exe file and all but... the installer does not ask you WHERE to install, it just installs into a defualt directory that couldn't be worse (C:\Documents and Settings\blah blah blah). ****...

Am I blind not being able to see the obvious or is Microsoft just too plain stupid?

intermario_gr
January 28th, 2008, 03:39 PM
Ahh, never mind! I used the NSIS installer to deploy my application. Much simpler and effective. The VS2005 Deployment thing was for morons anyway... :wave: