Console application checking if .NET installed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Stoop

    Console application checking if .NET installed

    If .NET is not installed my console application pops up "the application
    failed to initialize properly" dialog.

    Can I programatically tell if .NET is installed, and pre-emp this message
    with my own ?

    thanks


  • Rene

    #2
    Re: Console application checking if .NET installed

    Consider that the people not installing .NET might very well be some of
    the same people that never runs Windows Update, so they would never have
    this code that knew how to install .NET in the first place.
    I can see your point, but .Net has bee around for a while, if Microsoft
    would have started doing something about this issue since the very
    beginning, *most* computer today would be able to handle this in a very
    graceful way.

    Yes I agree that there would always be a computer here or there that would
    not be able to handle this, when this happens you will get an email and tell
    the user how to fix the problem I guess.


    Comment

    • Willy Denoyette [MVP]

      #3
      Re: Console application checking if .NET installed

      "Brian Stoop" <b.stoop@consul tant-spam.free.comwr ote in message
      news:%23ZyBS19d IHA.1164@TK2MSF TNGP02.phx.gbl. ..
      Thanks Willy.
      >
      Your VBScript code checks the registry I think. I can check the regisry
      from my Console App, but if .NET is not is not installed then the same
      problem exists?
      >
      Is this Catch 22?
      >
      Exactly, you can't use a .NET program to check whether .NET is installed.
      You need unmanaged code, and the easiest that comes to mind is a simple
      script (vbscript, jscript), Windows comes with the scripting engines
      installed by default.


      Willy.

      Comment

      • Brian Stoop

        #4
        Re: Console application checking if .NET installed

        Its Catch 22 then. My app uses Managed code, and I dont wish to have 2
        applications.

        Thanks to everyone, B


        "Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message
        news:ekK1169dIH A.5280@TK2MSFTN GP02.phx.gbl...
        "Brian Stoop" <b.stoop@consul tant-spam.free.comwr ote in message
        news:%23ZyBS19d IHA.1164@TK2MSF TNGP02.phx.gbl. ..
        >Thanks Willy.
        >>
        >Your VBScript code checks the registry I think. I can check the regisry
        >from my Console App, but if .NET is not is not installed then the same
        >problem exists?
        >>
        >Is this Catch 22?
        >>
        >
        Exactly, you can't use a .NET program to check whether .NET is installed.
        You need unmanaged code, and the easiest that comes to mind is a simple
        script (vbscript, jscript), Windows comes with the scripting engines
        installed by default.
        >
        >
        Willy.
        >

        Comment

        • Willy Denoyette [MVP]

          #5
          Re: Console application checking if .NET installed

          No need to write two applications, say you have a console application
          "someapp.ex e", then you can simply make a command line script like this:

          @rem startapp.cmd
          @Echo off
          Set Version="HKLM\S OFTWARE\Microso ft\NET Framework Setup\NDP\v2.0. 50727"
          reg query %version% /v Version >nul 2>nul
          if not %errorlevel% == 0 (
          Echo No such .Net version: %Version%
          goto :end
          )
          someapp.exe
          :end

          Willy.

          "Brian Stoop" <b.stoop@consul tant-spam.free.comwr ote in message
          news:%23R%23fpR %23dIHA.6092@TK 2MSFTNGP06.phx. gbl...
          Its Catch 22 then. My app uses Managed code, and I dont wish to have 2
          applications.
          >
          Thanks to everyone, B
          >
          >
          "Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message
          news:ekK1169dIH A.5280@TK2MSFTN GP02.phx.gbl...
          >"Brian Stoop" <b.stoop@consul tant-spam.free.comwr ote in message
          >news:%23ZyBS19 dIHA.1164@TK2MS FTNGP02.phx.gbl ...
          >>Thanks Willy.
          >>>
          >>Your VBScript code checks the registry I think. I can check the regisry
          >>from my Console App, but if .NET is not is not installed then the same
          >>problem exists?
          >>>
          >>Is this Catch 22?
          >>>
          >>
          >Exactly, you can't use a .NET program to check whether .NET is installed.
          >You need unmanaged code, and the easiest that comes to mind is a simple
          >script (vbscript, jscript), Windows comes with the scripting engines
          >installed by default.
          >>
          >>
          >Willy.
          >>
          >
          >

          Comment

          • Brian Stoop

            #6
            Re: Console application checking if .NET installed

            Thanks, but I need a wrapper free solution.

            I appreciate your help, B

            "Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message
            news:%23$ebYC$d IHA.4684@TK2MSF TNGP06.phx.gbl. ..
            No need to write two applications, say you have a console application
            "someapp.ex e", then you can simply make a command line script like this:
            >
            @rem startapp.cmd
            @Echo off
            Set Version="HKLM\S OFTWARE\Microso ft\NET Framework Setup\NDP\v2.0. 50727"
            reg query %version% /v Version >nul 2>nul
            if not %errorlevel% == 0 (
            Echo No such .Net version: %Version%
            goto :end
            )
            someapp.exe
            :end
            >
            Willy.
            >
            "Brian Stoop" <b.stoop@consul tant-spam.free.comwr ote in message
            news:%23R%23fpR %23dIHA.6092@TK 2MSFTNGP06.phx. gbl...
            >Its Catch 22 then. My app uses Managed code, and I dont wish to have 2
            >applications .
            >>
            >Thanks to everyone, B
            >>
            >>
            >"Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message
            >news:ekK1169dI HA.5280@TK2MSFT NGP02.phx.gbl.. .
            >>"Brian Stoop" <b.stoop@consul tant-spam.free.comwr ote in message
            >>news:%23ZyBS1 9dIHA.1164@TK2M SFTNGP02.phx.gb l...
            >>>Thanks Willy.
            >>>>
            >>>Your VBScript code checks the registry I think. I can check the regisry
            >>>from my Console App, but if .NET is not is not installed then the same
            >>>problem exists?
            >>>>
            >>>Is this Catch 22?
            >>>>
            >>>
            >>Exactly, you can't use a .NET program to check whether .NET is
            >>installed. You need unmanaged code, and the easiest that comes to mind
            >>is a simple script (vbscript, jscript), Windows comes with the scripting
            >>engines installed by default.
            >>>
            >>>
            >>Willy.
            >>>
            >>
            >>
            >
            >

            Comment

            Working...