I've a Console Application
project in a Visual Studio Solution
. This application, called here for semplicity MyApplication.exe, is nothing but an host of a WCF Service.
I need an installer for install my application on the target machine, so I download the Microsoft Visual Studio Installer Projects
extension. I collected all the files I want to be copied into the Application Folder but I want that the installer even registers my service as a Windows Service.
For this goal, I imported the InstallUtil.exe
just like shown on the below picture. I created the nested extra folders (Windows Folder -> Microsoft.NET -> Framework64 -> v4.030319) in order to reflect the actual structure of the target environment.
Then I created the Custom Action
like this under the Commit
node:
with the following Arguments:
"[TARGETDIR]MyApplication.exe"
I tried the generated setup and I noticed that all the files are copied but the service is not installed (I don't see it on the MSC list).
So, below my questions:
App.config
contains a KeyValue [Server="localhost"] is there a way to customize it at installation time with a popup to the user: 'Where is your server?" and update my config file with the information prompted by the user?Limits : Visual Studio Installer Projects have many limitations ( short version, Chris Painter ).
Alternative Tools : There are many other tools, some of which are free .
WiX Toolkit : The WiX Toolkit is free and open source. Here are two examples of how to install services without the need to run custom actions (the ability to install services is built-in to MSI, no need to use
InstallUtil.exe
- the "say no" to unnecessary custom action campaign ):
Links :
Perhaps this will be useful to someone in a similar situation.
Using Statement
using System.Configuration.Install;
Installing
ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location });
Uninstalling
ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location });
The above handles the functionality for the InstallUtil you've mentioned.
Documentation
ManagedInstallerClass.InstallHelper
The utility is located in the following places:
.NET directories on a Windows system:
InstallUtil.exe is digitally signed by Microsoft.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.