THE BORE
General => The Superdeep Borehole => Topic started by: Ecrofirt on January 31, 2008, 02:28:30 AM
-
I've made a nifty little program in C# that I plan on distributing via CD to students on campus. Problem is, the program obviously won't run unless I've got the right version of .NET (in this case, 2.0) installed.
So, I need to make an executable that will get autorun via autorun.inf that checks to see if .NET 2.0 is installed. If it is installed, it'll then launch my program. If it isn't, it'll launch the .NET 2.0 installer.
I've done a lot of googling on this and tried several things that haven't worked. I clearly need to write this tiny application in a non-.NET language, but at this point, C# and shit are all I remember how to do.
I've tried the following, and have been unsuccessful:
I wrote a .vbs that would do the above check. The .vbs runs fine by itself, but I can't link to it in the autorun.inf. If I do, I get an error. If I try to 'compile' the .exe, it ends up unzipping it to a folder that's not on the CD (obviously), and then it can't find my executables.
I wrote a batch file to do what I need and ran into fairly similiar problems.
So, that leaves me with needing to write this in some programming language I've never used.
Here's some pseudo-code that coves exactly what I need it to do:
If RegistryKey (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v2.0) exists Then
(alternatively I can check if C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 exists)
Run my program
Else
Run .Net 2.0 installer
Run my program
End if
I downloaded Python because it looks like I could pull this off really quickly with it and then compile the code to .exe. Problem is, it returns False for me when I check to see if the folder exists. I have absolutely NO Python experience, so I've got no idea how to fix it.
If anyone knows Python and wants to look at my code, it would be appreciated.
Otherwise, i'm open to suggestions for other really easy languages that I can do this in and then compile down to .exe so the CD'll work.
-
Isn't there any way you can compile the C# program to include the necessary .net libraries instead of requiring a download?
I looked for that in the project properties for a while today and didn't see anything. Granted, I'm using an Express Edition, so I have no idea if that option is available or not.
-
just put the .net 2.0 (or greater) redist on the CD, and create an install.bat or setup.bat (or whatever.bat) that attempts to install the redist first and call it from autorun. if they have it already installed, it'll pop up a message box and continue merrily onward.
-
just put the .net 2.0 (or greater) redist on the CD, and create an install.bat or setup.bat (or whatever.bat) that attempts to install the redist first and call it from autorun. if they have it already installed, it'll pop up a message box and continue merrily onward.
I've done that. It works somewhat, but it's kinda icky. I'd rather it look more elegant and not even pop up the .NET installer unless it needs to.
And, btw, the popup you get if you've already got .Net installed isn't something simple like a "Product already installed". It's a "Repair" / "Remove" popup. Icky, icky, icky.
-
also, yer pseudocode should test for 2.0 and greater -- there's 3.0 and 3.5 out there as well. i'm going to bed, but if it's still stumping you tomorrow, i'll hack up something for you.
-
And, btw, the popup you get if you've already got .Net installed isn't something simple like a "Product already installed". It's a "Repair" / "Remove" popup. Icky, icky, icky.
you sure you're trying to install JUST the crt redist and not the sdk? it doesn't do that for me.
-
And, btw, the popup you get if you've already got .Net installed isn't something simple like a "Product already installed". It's a "Repair" / "Remove" popup. Icky, icky, icky.
you sure you're trying to install JUST the crt redist and not the sdk? it doesn't do that for me.
This is the file I've got:
http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en
-
also, yer pseudocode should test for 2.0 and greater -- there's 3.0 and 3.5 out there as well. i'm going to bed, but if it's still stumping you tomorrow, i'll hack up something for you.
Shit, didn't even think of that
-
And, btw, the popup you get if you've already got .Net installed isn't something simple like a "Product already installed". It's a "Repair" / "Remove" popup. Icky, icky, icky.
you sure you're trying to install JUST the crt redist and not the sdk? it doesn't do that for me.
This is the file I've got:
http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en
huh, that's the redist alright. are you specifying quiet mode? try installing with "dotnetfx.exe /q:a" if you haven't.
-
And, btw, the popup you get if you've already got .Net installed isn't something simple like a "Product already installed". It's a "Repair" / "Remove" popup. Icky, icky, icky.
you sure you're trying to install JUST the crt redist and not the sdk? it doesn't do that for me.
This is the file I've got:
http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en
huh, that's the redist alright. are you specifying quiet mode? try installing with "dotnetfx.exe /q:a" if you haven't.
Well shit no. I wasn't using any command line options. Just running the executable if they didn't have .Net
And running it with /q:a still gives me the Repair/Remove option on my PC.
-
This is one thing I've come to hate about making small apps in Windows.
-
Hah, most ghetto solution ever thanks to Drinky.
My batch file calls my .vbs file, which opens my Sophos frontend like a charm.
Now to test it on some PCs without .NET 2.0!