views:

160

answers:

4

I cannot create .msi files cause I don't have VS professional, and I want to have much more control over the installer than NSIS or Inno Setup give me.

Things I don't know how to do:

  • Compress the file(s) into the installation file
  • Extract the file(s)
  • Remove the file(s) on uninstallation

Any help would be much appreciated.

I'll stress this point though: I do not want to use an existing tool.

+4  A: 

If you really don't want to use something sane like WiX, then you're left with the direct MSFT installer APIs. They're on MSDN starting here : http://msdn.microsoft.com/en-us/library/aa372860%28VS.85%29.aspx, and that's what Microsoft used to use before developing WiX.

Steve Gilham
Err, how do I use that? I cannot seem to find the "Installer" object.
Cyclone
Use GetTypeFromProgID and Activator.CreateInstance.You can ask for the type using the GetTypeFromProgID method of the Type object. Then use the static method Activator.CreateInstance to create it from the Type.
Steve Gilham
+2  A: 

Have you heard of WiX? It's open source for creating MSI files.

Daniel A. White
"I do not want to use an existing tool." Thanks anyway, I have tried it but I don't like it.
Cyclone
WiX gives you a lot of control. Why do you want to reinvent the wheel.
Daniel A. White
I don't like WiX. I would find it much easier to make my own.
Cyclone
I promise, it won't be easier. WIX was created for making installers easier. The MSI API is a beast.
Byron Whitlock
I want to create my own. Please, can you simply answer the question I asked instead of telling me to use things I specifically pointed out that I did not want to use?
Cyclone
Check steves answer. Everything you need is there. You might have a hard time finding help because almost nobody does it that way. Good Luck!
Byron Whitlock
Where the heck is the installer component though lol?
Cyclone
+1  A: 

Are you sure you have looked at the control that NSIS gives you?

I've not found anything you need to do that cant be done with nsis. The only drawback is the the steep learning curve.

If you can afford it get Installshield. There is a reason the majority of commercial software uses Installshield, It is easy and lets you spend time working on real problems, not worrying about stupid installer minutia.

Otherwise write your own installer and enjoy the pain of reinventing the wheel.

EDIT You can use ClickOnce installer with the express editions. I've used it before and it is very nice indeed.

Byron Whitlock
I looked, I don't like it, I can't afford installshield, and I tried NSIS, WIX, Inno Setup, Advanced Installer, and several others. And yeah, I want to write my own. Reinventing the wheel only hurts if you don't have the time to do so. I am currently sick with swine flu, this is no issue. Now, how can I go about writing my own?
Cyclone
@ClickOnce: Web installer I think? I tried it once, it kept breaking my application for some reason...
Cyclone
+2  A: 

If you insist on doing this, add a reference to %windir%\system32\msi.dll to your project & the WindowsInstaller namespace will be available to Import.

I don't know what you want to do that's so special that Inno, NSIS or Wix can't do it simply enough, but this isn't going to be any picnic.

DaveE
Don't care, thanks!
Cyclone
K, can you give some usage examples?
Cyclone
I don't have any handy, but there are some code samples in the Windows Installer SDK that comes with the Windows SDK. http://msdn.microsoft.com/en-us/library/aa370834(VS.85).aspx will get you started.
DaveE