JDYoder Posted August 4, 2005 Posted August 4, 2005 How can I determine on a computer if it has the .NET framework installed? Some registry key? Quote
techmanbd Posted August 4, 2005 Posted August 4, 2005 Are you just looking to see? If so you can goto control panel and look at the list in "add/remove programs". It is listed in there Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
JDYoder Posted August 4, 2005 Author Posted August 4, 2005 Something other than that. We have an installation program that needs to check if the .NET framework is installed on a machine. So I want it to check the registry... or something... whatever it takes. Quote
Administrators PlausiblyDamp Posted August 5, 2005 Administrators Posted August 5, 2005 http://www.xtremedotnettalk.com/showthread.php?t=73223 Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
mskeel Posted August 5, 2005 Posted August 5, 2005 http://msdn.microsoft.com/vstudio/downloads/tools/bootstrapper/default.aspx The .Net redistributalbe bootstrapper may be an even better way... Quote
neodammer Posted August 5, 2005 Posted August 5, 2005 Most programs that I obtain now days includes the bootstrapper so me thinks this is a good idea. I dont know why anybody would try to fake the directory though, im not sure if you uninstall the .net does it leave the directory ? some programs do in that case you would want to use bootstrapper. Quote Enzin Research and Development
JDYoder Posted August 5, 2005 Author Posted August 5, 2005 For now, I'll check for the "%windir%\Microsoft.Net\Framework" directory, which brings me to another question... What registery setting do I check in order to obtain the windows directory? Quote
mskeel Posted August 5, 2005 Posted August 5, 2005 I'm not trying to push or anything, but you realize that the bootstrapper preforms that check for you, right? You get it all for free. The only way I would not go with the bootstrapper is if I didn't want my program installed if the target machine didn't have the .Net Framework. (With the bootstrapper the .Net Framework will be installed for you if it isn't already installed) Other than that, if you try and use a .Net installer on a machine that doesn't have the .Net framework installed, it will also preform a check and then tell the user that they need to go to a website (link given) and download the .Net redistributable package. So if your worries are something other than installation compaitibility concerns, the directory check will do for whatever it is that you are doing. And %WINDIR% is the environment variable you need to check. Go to a command prompt and hit 'set'. You'll see that variable toward the bottom. Quote
JDYoder Posted August 5, 2005 Author Posted August 5, 2005 The only way I would not go with the bootstrapper is if I didn't want my program installed if the target machine didn't have the .Net Framework. This is our scenerio, which is why I'm doing it this way. The long story is we are piggy-backing a very small .NET program onto a large VB6 program and setup that already exists. The .NET program is optional for the user. So I just need to check for the existence of the .NET framework and tell them if they don't have it. And %WINDIR% is the environment variable you need to check. Go to a command prompt and hit 'set'. You'll see that variable toward the bottom. But that's just for my machine. I need this to work on any machine, regardless if they have "C:\Windows", "C:\WINNT", "D:\BobsWindows", etc. So I'm assuming it's a registry call. But no one knows it? Quote
pas30339 Posted August 5, 2005 Posted August 5, 2005 (edited) This is our scenerio, which is why I'm doing it this way. The long story is we are piggy-backing a very small .NET program onto a large VB6 program and setup that already exists. The .NET program is optional for the user. So I just need to check for the existence of the .NET framework and tell them if they don't have it. But that's just for my machine. I need this to work on any machine, regardless if they have "C:\Windows", "C:\WINNT", "D:\BobsWindows", etc. So I'm assuming it's a registry call. But no one knows it? I suggest, in the event the .NET Framework is absent, you install it regardless of whether the user chooses to install the .NET application you are piggybacking. At some point or another the .NET Framework will need to be installed anyway so may as well have it over and done with. Edited August 5, 2005 by pas30339 Quote
JDYoder Posted August 8, 2005 Author Posted August 8, 2005 But I still want to tell them they don't have the .NET framework installed. So from the answers I'm getting, I assume this is impossible via the registry? Quote
mskeel Posted August 8, 2005 Posted August 8, 2005 Quote: Originally Posted by mskeel And %WINDIR% is the environment variable you need to check. Go to a command prompt and hit 'set'. You'll see that variable toward the bottom. But that's just for my machine. I need this to work on any machine, regardless if they have "C:\Windows", "C:\WINNT", "D:\BobsWindows", etc. So I'm assuming it's a registry call. But no one knows it? You can find environment settings in the registry, though I am unsure where. And again, you can also check the environement variable directly. In .Net you would do this with a call to Environment.GetEnvironmentVariable(string) Quote
Administrators PlausiblyDamp Posted August 8, 2005 Administrators Posted August 8, 2005 %WinDir% is a standard environment variable - you won't need to process the registry to find it. Just about every programming language / install tool has some method for evaluating these - what tool(s) are you looking at using to discover the existance (or not) of this directory? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
pas30339 Posted August 9, 2005 Posted August 9, 2005 This should do the trick. http://support.microsoft.com/default.aspx?scid=kb;en-us;315291 Quote
JDYoder Posted August 9, 2005 Author Posted August 9, 2005 %WinDir% is a standard environment variable - you won't need to process the registry to find it. Just about every programming language / install tool has some method for evaluating these - what tool(s) are you looking at using to discover the existance (or not) of this directory? The installation tool is Wise 7.0, which is quite old. It does have a %WIN% variable which has worked in the past, however, on this one machine it returns this value... C:\DOCUMENT AND SETTINGS\ADMINISTRATOR\WINDOWS\MICROSOFT.NET\FRAMEWORK Which is very odd to me. Any ideas why that would be? Since Wise 7.0 can access the registry, I thought I'd try that, but I'm open to other suggestions. (Other than upgrading the setup package, which isn't an option at the moment.) This should do the trick. http://support.microsoft.com/default.aspx?scid=kb;en-us;315291 Maybe that'll work if I can check for the reg folder... HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\ I'll give that a shot unless anyone has a different idea that would be better. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.