CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2005
    Posts
    46

    Catching ".NET framework not found" exception? How do I do it?

    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.

  2. #2
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Catching ".NET framework not found" exception? How do I do it?

    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).
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Catching ".NET framework not found" exception? How do I do it?

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Apr 2005
    Posts
    46

    Re: Catching ".NET framework not found" exception? How do I do it?

    Quote Originally Posted by dglienna

    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.

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Catching ".NET framework not found" exception? How do I do it?

    Or scripting. Whatever you are comfortable in, except .Net
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Apr 2005
    Posts
    46

    Re: Catching ".NET framework not found" exception? How do I do it?

    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?

  7. #7
    Join Date
    Apr 2005
    Posts
    46

    Re: Catching ".NET framework not found" exception? How do I do it?

    Ahh, never mind! I used the NSIS installer to deploy my application. Much simpler and effective. The VS2005 Deployment thing was for morons anyway...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured