From: Chris on

I am already checking it in the installation script but apparently too many
people decide to uninstall the .net framework at some point. I will probably
just launch my app from an unmanaged exe like you suggested.

Thanks for the help,
Chris

"Prashant" wrote:

> If you have managed executable this is how it works.The operating system
> loader checks for managed modules by examining a bit in the common object
> file format (COFF) header. The bit being set denotes a managed module. If the
> loader detects managed modules, it loads mscoree.dll, and _CorValidateImage
> and _CorImageUnloading notify the loader when the managed module images are
> loaded and unloaded.
> You won't be able to turn off/on the bit in COFF header by running the
> managed executable. Its not possible to run Managed Executable without CLR
> which in turn need .net assemblies
>
> But you could probably write an executable in unmanaged code to check for
> .net framework and display a dialog box if it doesn't exist and if it does
> exists you could launch your managed executable from your unmanaged code and
> terminate the unmanaged exe.Managed exe will impersonate the calling process
> security access token.
>
> If your application is being deployed you could also make use of the
> installation script to warn users.
>
>
> "Chris" wrote:
>
> > Thanks for the responses,
> >
> > Checking if the registry values exist is not a problem, going back to the
> > original question, the problem is needing to check from a managed project. I
> > was told that I cannot add any new assemblies to our installation so I need
> > to know if it is even possible to do. Can I call unmanaged code in a managed
> > project in a way that the managed code is not loaded until after I check the
> > registry with unmanaged code? Therefore, the executable will not crash before
> > the check allowing me to show a dialog if the .net framework does not exist.
> >
> > Thanks,
> > Chris
> >
> > "Prashant" wrote:
> >
> > > As Michael already mentioned, please refer to the below link on registry key
> > > detail
> > > http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;315291
> > >
> > > "Michael Nemtsev [MVP]" wrote:
> > >
> > > > Hello Chris,
> > > >
> > > > why not to check the registry entries for .NET existence?
> > > >
> > > > it's installed into specific hives and can be easily tracked
> > > >
> > > > ---
> > > > WBR,
> > > > Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour
> > > >
> > > > "The greatest danger for most of us is not that our aim is too high and we
> > > > miss it, but that it is too low and we reach it" (c) Michelangelo
> > > >
> > > >
> > > > C> To elaborate,
> > > > C> When do the managed assemblies get loaded? If I can call unmanaged
> > > > C> code before hand I would be able to check it then.
> > > >
> > > >
> > > >