-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Install 2 windows services in same installer #552
Comments
new File("Svr1.exe",
new ServiceInstaller
{
Name = "Svr1",
DisplayName = "Svr1",
Description = "Svr1",
StartOn = SvcEvent.Install_Wait,
DependsOn = ServicesName,
StopOn = SvcEvent.InstallUninstall_Wait,
RemoveOn = SvcEvent.Uninstall_Wait,
DelayedAutoStart = true,
StartType = SvcStartType.auto,
FirstFailureActionType = FailureActionType.restart,
SecondFailureActionType = FailureActionType.restart,
ThirdFailureActionType = FailureActionType.restart,
RestartServiceDelayInSeconds = 10,
ResetPeriodInDays = 1,
RebootMessage = "Failure actions do not specify reboot",
}),
new File("Svr2.exe",
new ServiceInstaller
{
Name = "Svr2",
DisplayName = "Svr2",
Description = "Svr2",
StartOn = SvcEvent.Install_Wait,
DependsOn = ServicesName,
StopOn = SvcEvent.InstallUninstall_Wait,
RemoveOn = SvcEvent.Uninstall_Wait,
DelayedAutoStart = true,
StartType = SvcStartType.auto,
FirstFailureActionType = FailureActionType.restart,
SecondFailureActionType = FailureActionType.restart,
ThirdFailureActionType = FailureActionType.restart,
RestartServiceDelayInSeconds = 10,
ResetPeriodInDays = 1,
RebootMessage = "Failure actions do not specify reboot",
}), |
This doesn't work. You end up with the Component element for both services having a ServiceControl element with an Id of StartSvr2. This generates an error when Wix tries to interpret the wxs file and no msi is created. There are 2 factors to this: The same thing happens with StopOn and RemoveOn. The solution I have used is to create new instances of SvcEvent for each ServiceInstaller. As SvcEvent has a private constructor and one of the properties that needs setting is protected this requires some rather nasty reflection. I don't think that the setter of OnStart should be modifying the object passed into it. |
It is a very interesting one.
Actually it is not the same instance. These are the static properties the return a fresh new instance of the class on every access: I still don't see a good reason for keeping constructor private but it is a different story. Please share your Reflection based solution so I can see what can be done to solve this problem. |
@Xaddan thank you, looking into it |
I am using v1.9.3.0 of WxisSharp. In this version SvcEvent.InstallUninstall_Wait is a public field rather than a public property. This means that all the ServiceInstallers will have the same instance. |
- Issue #552: Question: Install 2 windows services in same installer
Done. Will be available in the very next release |
* VS project templates - added packages.config files * Added Condition-s for .NET Frameworks 4.7.1 and 4.7.2 * Issue #569: Updating WixSharp leads to malfuncion of SetEvVar * Added support for `UI.Error` WiX element * Issue #552: Question: Install 2 windows services in same installer * Issue #541: Installing 2 Services in the same installer results in … * Samples update * Issue #560: Semantic difference between UninstallCondition and IsUninstalling * Issue #564: Correct variable name of SequentialGuid initialization. * Issue #562: Typo in Compiler.cs comments * Issue #561: Typo in WixProject.cs * Added missing namespace in custom dialog template, fixed comment. * Added explicit `WixEntity.ComponentId` property * Issue #551: Cannot include extra .wxs as part of a bundle * Issue #542: ServiceInstaller.StartOn/StopOn/RemoveOn - Documentation bug * Issue #544: Failed while processing WebSites; added support for `IISVirtualDir.AttributesDefinition`
Hallo, how to you ServiceInstaller for install 2 different windows services or use installutil.exe twice ?
Is there some posibility ?
The text was updated successfully, but these errors were encountered: