Author Topic: A bit of programming advice is needed  (Read 1227 times)

0 Members and 1 Guest are viewing this topic.

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
A bit of programming advice is needed
« 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:
Quote
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.
8=D

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: A bit of programming advice is needed
« Reply #1 on: January 31, 2008, 02:35:35 AM »
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.
8=D

Van Cruncheon

  • live mas or die trying
  • Banned
Re: A bit of programming advice is needed
« Reply #2 on: January 31, 2008, 02:41:15 AM »
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.
duc

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: A bit of programming advice is needed
« Reply #3 on: January 31, 2008, 02:45:06 AM »
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.
« Last Edit: January 31, 2008, 02:46:49 AM by Ecrofirt »
8=D

Van Cruncheon

  • live mas or die trying
  • Banned
Re: A bit of programming advice is needed
« Reply #4 on: January 31, 2008, 02:50:15 AM »
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.
duc

Van Cruncheon

  • live mas or die trying
  • Banned
Re: A bit of programming advice is needed
« Reply #5 on: January 31, 2008, 02:51:09 AM »


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.
duc

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: A bit of programming advice is needed
« Reply #6 on: January 31, 2008, 02:54:21 AM »


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
8=D

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: A bit of programming advice is needed
« Reply #7 on: January 31, 2008, 02:54:52 AM »
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
8=D

Van Cruncheon

  • live mas or die trying
  • Banned
Re: A bit of programming advice is needed
« Reply #8 on: January 31, 2008, 03:02:05 AM »


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.
duc

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: A bit of programming advice is needed
« Reply #9 on: January 31, 2008, 03:05:19 AM »


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.
8=D

bluemax

  • Senior Member
Re: A bit of programming advice is needed
« Reply #10 on: January 31, 2008, 03:21:43 AM »
This is one thing I've come to hate about making small apps in Windows.
NO

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: A bit of programming advice is needed
« Reply #11 on: January 31, 2008, 03:35:52 AM »
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!
8=D