none
.Net Framework 2.0 compile override ... ?!!! RRS feed

  • Question

  •  

    I have a very unique problem related to my application ...

     

    I have a windows application (say abc.exe, and 20 or so other referenced dlls) built in 2.0 using C#.

     

    Since this application is going to be used on a number of machines that will not have 2.0 framework already installed. And everytime this application is run on such a machine it blows with error saying 'mscorlib cannot be loaded, please re-install framework' or something like this (which is perfectly understandabe).

     

    Now my problem is that I want to trap this error and display a custom text message or even give an option of installing framework 2.0.

     

    My limitation is that I can only implement the solution in abc.exe or through a referenced dll of abc.exe. Since this error is coming from compiler and application is not even getting loaded it poses a very big problem for me.

     

    Is there ANY WAY I could implement a solution to this problem or anyone has an input on the issue, PLEASE let me know asap I would GREATLYappreciate it.

    Wednesday, September 12, 2007 4:57 PM

Answers

  • Hi,

         What I can suggest is that you should create an installer for your application and package the exe and all its dependent dlls in the installer. Installer can be created using Setup and Deployement project. In this project you can have a condition to check if the machine, on which you are trying to install your application, has .Net Framework or not. You can even package the .Net Framework installer and install it along with your application.

     

    You can visit http://www.c-sharpcorner.com/UploadFile/vishnuprasad2005/SetupProjects12022005022406AM/SetupProjects.aspx

    for reference.

     

    Hope this helps.

     

    Regards,

    Asim.

    Wednesday, September 12, 2007 5:19 PM
  • Just check the registry for key HKLM\ SOFTWARE\ Microsoft\ .NETFramework\ v2.0.50727.  If it's not there, the app isn't going to run.
    Wednesday, September 12, 2007 6:25 PM
    Moderator

All replies

  • Hi,

         What I can suggest is that you should create an installer for your application and package the exe and all its dependent dlls in the installer. Installer can be created using Setup and Deployement project. In this project you can have a condition to check if the machine, on which you are trying to install your application, has .Net Framework or not. You can even package the .Net Framework installer and install it along with your application.

     

    You can visit http://www.c-sharpcorner.com/UploadFile/vishnuprasad2005/SetupProjects12022005022406AM/SetupProjects.aspx

    for reference.

     

    Hope this helps.

     

    Regards,

    Asim.

    Wednesday, September 12, 2007 5:19 PM
  • Well that's the thing, I have to implement it only in my win application. No installers, no pre-2.0app-launcher-for-verification-process application etc.

     

    It is simply running 2.0 app on 1.1 framework machine, and if it fails to load display custom error through application ....

    Wednesday, September 12, 2007 5:30 PM
  • Just check the registry for key HKLM\ SOFTWARE\ Microsoft\ .NETFramework\ v2.0.50727.  If it's not there, the app isn't going to run.
    Wednesday, September 12, 2007 6:25 PM
    Moderator
  • How can I check the registry in the application when application fails to load because 2.0 is not installed?

     

    I cannot check the machines manually. It has to be in the code/application ...

    Wednesday, September 12, 2007 6:45 PM
  • Use a VBS script.
    Wednesday, September 12, 2007 7:33 PM
    Moderator
  • Again even if i create the VBS script, I still have to run the script "manually". I cannot do that. All I user is allowed to do is to run the win app, and if it fails because .Net 2.0 is not installed, display a custom message.

     

    Do you mean to say that I run the VBS script from the application?

    Wednesday, September 12, 2007 7:47 PM
  • No, you run the application from the script.  After you checked that the framework is available.  Obvious, right?
    Wednesday, September 12, 2007 8:48 PM
    Moderator
  •  

    How about writing a small executable (dot net 1.x) that checks the registry entry for 2.0 and then runs the 2.0 app. 

     

    If it's not there, then display your error message.

     

    Then you only need to be assured that dot net 1.x is on the workstation which is more likely.

     

    Hope that helps.

     

     

     

    Wednesday, September 12, 2007 9:12 PM
  • In both of the above mentioned cases I have to run "an external" app, other than my main application, to accomplish this. And this is something I cannot do under my extra ordinary circumstances.

     

    Is it possible to compile one single application which would support both 1.1 and 2.0 frameworks?

     

    It sounds really weird but is there anything that would make CLR display a custom message based on some xyz condition? Or CLR throwing some flag to the "loading" application saying that it cant be loaded?

    Thursday, September 13, 2007 2:47 PM