问题
I'd like to create a file 'setup.exe' that contains one application that I developed in C#, and the setup of .Net framework 4.0.
The idea is: When I execute the 'setup.exe' this one will check if have the .net framework 4.0 installed on the computer, and if don't install it!
Using InstallShield 2009.
Anyone knows how to do this?
Let me know if don't understand anything.
Thanks.
回答1:
Regarding setup you can use the built-in mechanism which come with Visual Studio, they allow for example to make setup.exe automatically check if the needed framework version is installed and install it if not present - for a good starting see MSDN.
Regarding making your application/EXE consist of 1 file including all managed dependencies you have several options:
- use ILMerge (free)
For howto see here and here
OR
- use some tool like SmartAssembly (commercial)
it can embed and merge among other things (no need to change your source code)
OR
- code that yourself in less than 10 lines (free but minimal source code change)
mark all needed dependencies as "embedded resource" - this way they are included in the EXE file... you need to setup an AssemblyResolve handler which at runtime reads from Resources and returns the needed DLLs to the .NET runtime...
回答2:
There are many frameworks for creating setups.
My favorite one is WIX, you can download it from here: http://wix.sourceforge.net/
There's also a framework for creating WIX interfaces using C#, called sharpsetup, you can download it from here: http://sharpsetup.eu/ but I'm not sure it's gonna suit your needs, as the target machine might not have .NET to start with(although it might be possible to write the setup in .NET 2.0, I'm not sure).
Learning WIX can take some time, but once you are past this, it shouldn't be too hard to do what you want.
回答3:
Is viable to pack your full (splitted) setup in a self-extractor? You can use WinRar or similar to build a compressed exe with "autorun".
回答4:
Not possible with the standard InstallShield 2009, as far as I know. You have to have at least InstallShield 2010 (with the Installshield 2010 Expansion Pack for Visual Studio 2010).
I do not know if there is a way to "hack" it in...
回答5:
I resolved this question, creating a custom action, this one would be 'Open executable' type and I called this custom action in a button event of the wizard.
来源:https://stackoverflow.com/questions/9705549/how-to-pack-a-installation-framework-application-in-one-executable