Just about to try and make an install package for an app for that first time with visual studio. I have a registry value that needs to be changed when the program is installed I need the program to start everytime the computer starts.
Is this a fairly trivial task? Could someone point me towards something to try and achieve this.
So far I just have the app with it's forms etc.
I have same problem, I'm using WIX and follow the answer from this Stackoverflow question. I'm also new on WIX, here's my full WIX working script if you might interest (tested on Windows XP & Windows 8.1):
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="FooSetup" Language="1033"
Version="1.0.1.1"
Manufacturer="Foo Enterprise"
UpgradeCode="9235c293-2f08-4c2b-b7a5-69d01f5fca32">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<!-- Step 1: Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="FooSetup" />
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Foo Application"/>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<!-- Step 2: Add files to your installer package & add autostart feature -->
<DirectoryRef Id="INSTALLFOLDER">
<!-- The main executable file-->
<Component Id="FooApplication" Guid="3F122E60-3745-4AEB-ADA3-B90DCB87E0BD">
<File Id="FooMainApp" Source="$(var.Foo.TargetPath)" KeyPath="yes"/>
</Component>
<!-- The main lib file-->
<Component Id="FooLib" Guid="83BEDB02-C9F5-4A06-B3D5-0A4D61D6A99C">
<File Id="FooFileLib" Source="$(var.Foo.Lib.TargetPath)" KeyPath="yes"/>
</Component>
<!-- Register windows autostart registry -->
<Component Id="RegistryEntries" Guid="45C7AC46-1101-4301-83E1-D24392283A60">
<RegistryValue Type="string"
Name="FooStartup"
Value="[#FooMainApp]"
Root="HKLM"
Key="Software\Microsoft\Windows\CurrentVersion\Run"
Action="write"/>
</Component>
</DirectoryRef>
<!-- Step 3: Add the shortcut to your installer package -->
<!-- Start Menu -->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="FooShortcutMenu" Guid="3874D005-4E1C-4C0E-9CEA-8CD8D5442B60">
<Shortcut Id="FooApplicationStartMenuShortcut"
Name="Foo Application"
Description="The Foo is Cool!"
Target="[#FooMainApp]"
WorkingDirectory="INSTALLFOLDER"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\FooApplication" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Desktop Menu -->
<DirectoryRef Id="DesktopFolder">
<Component Id="FooDesktopShortcutMenu" Guid="D4D0A2ED-C0DB-4524-AC53-D30F904DB846">
<Shortcut Id="FooApplicationDesktopShortcut"
Name="Foo Application"
Description="The Foo is Cool!"
Target="[#FooMainApp]"
WorkingDirectory="INSTALLFOLDER"
Directory="DesktopFolder"/>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\FooApplication" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Tell Wix -->
<Feature Id="ProductFeature" Title="FooSetup" Level="1">
<ComponentRef Id="FooApplication" />
<ComponentRef Id="FooLib" />
<ComponentRef Id="FooShortcutMenu"/>
<ComponentRef Id="FooDesktopShortcutMenu"/>
<ComponentRef Id="RegistryEntries" />
</Feature>
</Product>
</Wix>
It depends the tool you used to create the install package, generally you need to add a String Value under
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run or
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
like "AppName" : "AppPath"
You also can achieve this by add the regstry in your code.
Related
I have a WPF application, to create an installer, I chose the Wix toolset. My application creates a local database, it is not included in the lists of files for installation. When I uninstall the app, my DB file is deleted, this works, but when I update an application, the file is also deleted. Help me figure out how to ensure that the file is not deleted during the update, but is deleted when the application is only deleted.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?define ProductName="MyApp"?>
<?define TargetFileName="MyApp Desktop.exe"?>
<?define description="MyApp"?>
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="1.0.8.0" Manufacturer="$(var.ProductName)" UpgradeCode="e7fa5ab6-bed7-4850-97e2-270bfd182983">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="$(var.description)"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="Installer" Level="1">
<ComponentRef Id="ShortcutMenu" />
<ComponentRef Id="ShortcutDesktop" />
<ComponentRef Id="INSTALLFOLDER_Permission" />
<ComponentRef Id="MyAppFolder" />
</Feature>
<Icon Id="icon" SourceFile="IconApp.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon" />
<WixVariable Id="WixUIBannerBmp" Value="Images/TopBanner.png"/>
<WixVariable Id="WixUIDialogBmp" Value="Images/DialogBanner.png"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
<UIRef Id="WixUI_InstallDir"/>
<Feature Id="BlazorAppFeature"
Title="BlazorWasmApplication"
Level="1"
ConfigurableDirectory="INSTALLFOLDER"
AllowAdvertise="no"
Absent='disallow'>
<ComponentGroupRef Id="PublishedComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="StructureIT">
<Component Id="MyAppFolder" Guid="24f047db-b522-478e-b0aa-fcc552c2f1a2">
<RemoveFile Id="PurgeAppFolder" Name="MyAppDB.db" On="uninstall" />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="decktop"/>
<Directory Id="ProgramMenuFolder" Name="MenuFolder" >
<Directory Id="ApplicationProgramsFolder" Name="Structure IT" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<Component Id="ShortcutMenu" Guid="302df662-167e-42b7-94ae-cb2ab4dec1a6" Directory="ApplicationProgramsFolder">
<Shortcut Id="StartMenu" Name="$(var.ProductName)" Description="$(var.description)" Target ="[INSTALLFOLDER]$(var.TargetFileName)" />
<RemoveFolder Id="RemoveShortcut" On="uninstall"/>
<Registry Root="HKCU" Key="SoftWare\[Manufacturer]\[ProductName]" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Fragment>
<Fragment>
<Component Id="ShortcutDesktop" Guid="e6a03b11-01b2-45ba-b7b3-77b0c09cdd3d" Directory="DesktopFolder" >
<Shortcut Id="ShortcutDesktop" Name="$(var.ProductName)" Description="$(var.description)" Target ="[INSTALLFOLDER]$(var.TargetFileName)" />
<RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" />
<Registry Root="HKCU" Key="SoftWare\[Manufacturer]\[ProductName]" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Fragment>
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="INSTALLFOLDER_Permission" Guid="76f2583f-d81a-4ea7-a76a-0eb08732b3e0">
<CreateFolder>
<util:PermissionEx User="Users" GenericAll="yes"/>
</CreateFolder>
</Component>
</DirectoryRef>
</Fragment>
</Wix>
The RemoveFile On="Uninstall" doesn't mean uninstall of the application it means uninstall of the component.
https://learn.microsoft.com/en-us/windows/win32/msi/removefile-table
Because your doing a major upgrade you're essentially uninstalling and reinstalling the component thus the file is deleted.
There's a few ways to address this.
If you have an EXE bootstrapper, place the component in it's own MSI and never update the MSI. This way the bootstrapper never updates that MSI and it only gets installed once and removed once.
Change the scheduling of RemoveExistingProducts in the Major Upgrade so that components get installed first and then removed. In this way the component won't be removed until final uninstall. This has side effects though that have to be understood.
Use a custom action with a condition of REMOVE="ALL" and Not UPGRADINGPRODUCTCODE to delete the file.
Or altenatively don't delete the file at all. Microsoft guidelines do actually say you shouldn't remove user data.
I have made C# project recently and try to run it at windows startup.
I configured WXS file in order to write Registry Run key (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)
Below is full of my WXS file.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="NACViewAgentSetupProject" Language="1033" Version="1.0.0.0" Manufacturer="JSGURU" UpgradeCode="MYGUID">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="NACViewAgentSetupProject" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="NACViewAgentSetupProject" />
</Directory>
<Directory Id="ProgramMenuFolder"></Directory>
</Directory>
</Fragment>
<Fragment>
<DirectoryRef Id="ProgramMenuFolder">
<Component Id="ApplicationShortcut" Guid="MYGUID">
<Shortcut Id="ApplicationStartMenuShortcut" Name="NACViewAgent" Description="NACVIEW Agent" Target="[INSTALLFOLDER]NACViewAgent.exe" WorkingDirectory="INSTALLFOLDER">
<!--AUMID-->
<ShortcutProperty Key="System.AppUserModel.ID" Value="NACVIEW.NACViewAgent"/>
<!--COM CLSID, specifying which CLSID to activate when toast clicked-->
<ShortcutProperty Key="System.AppUserModel.ToastActivatorCLSID" Value="{MYGUID}"/>
</Shortcut>
<RemoveFile Id="RemoveApplicationShortcut" Directory="ProgramMenuFolder" Name="NACViewAgent" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\NACVIEW" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
<Component Id="ApplicationAutostart" Guid="MYGUID">
<RegistryValue Root="HKCU" Action="write" Key="Software\Microsoft\Windows\CurrentVersion\Run" Name="NACViewAgent" Value="[INSTALLFOLDER]NACViewAgent.exe" Type="string"/>
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
<Component Id="NACViewAgent.exe" Guid="MYGUID">
<File Id="NACViewAgent.exe" Name="NACViewAgent.exe" Source="$(var.NACViewAgent.TargetDir)NACViewAgent.exe"/>
</Component>
<Component Id="GalaSoft.MvvmLight.dll" Guid="MYGUID">
<File Id="GalaSoft.MvvmLight.dll" Name="GalaSoft.MvvmLight.dll" Source="$(var.NACViewAgent.TargetDir)GalaSoft.MvvmLight.dll"/>
</Component>
<Component Id="Newtonsoft.Json.dll" Guid="MYGUID">
<File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" Source="$(var.NACViewAgent.TargetDir)Newtonsoft.Json.dll"/>
</Component>
<Component Id="Microsoft.WindowsAPICodePack.dll" Guid="MYGUID">
<File Id="Microsoft.WindowsAPICodePack.dll" Name="Microsoft.WindowsAPICodePack.dll" Source="$(var.NACViewAgent.TargetDir)Microsoft.WindowsAPICodePack.dll"/>
</Component>
<Component Id="CommonServiceLocator.dll" Guid="MYGUID">
<File Id="CommonServiceLocator.dll" Name="CommonServiceLocator.dll" Source="$(var.NACViewAgent.TargetDir)CommonServiceLocator.dll"/>
</Component>
<Component Id="System.Windows.Interactivity.dll" Guid="MYGUID">
<File Id="System.Windows.Interactivity.dll" Name="System.Windows.Interactivity.dll" Source="$(var.NACViewAgent.TargetDir)System.Windows.Interactivity.dll"/>
</Component>
<Component Id="GalaSoft.MvvmLight.Extras.dll" Guid="MYGUID">
<File Id="GalaSoft.MvvmLight.Extras.dll" Name="GalaSoft.MvvmLight.Extras.dll" Source="$(var.NACViewAgent.TargetDir)GalaSoft.MvvmLight.Extras.dll"/>
</Component>
<Component Id="GalaSoft.MvvmLight.Platform.dll" Guid="MYGUID">
<File Id="GalaSoft.MvvmLight.Platform.dll" Name="GalaSoft.MvvmLight.Platform.dll" Source="$(var.NACViewAgent.TargetDir)GalaSoft.MvvmLight.Platform.dll"/>
</Component>
<Component Id="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" Guid="MYGUID">
<File Id="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" Name="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" Source="$(var.NACViewAgent.TargetDir)Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll"/>
</Component>
<Component Id="Microsoft.WindowsAPICodePack.Sensors.dll" Guid="MYGUID">
<File Id="Microsoft.WindowsAPICodePack.Sensors.dll" Name="Microsoft.WindowsAPICodePack.Sensors.dll" Source="$(var.NACViewAgent.TargetDir)Microsoft.WindowsAPICodePack.Sensors.dll"/>
</Component>
<Component Id="Microsoft.WindowsAPICodePack.Shell.dll" Guid="MYGUID">
<File Id="Microsoft.WindowsAPICodePack.Shell.dll" Name="Microsoft.WindowsAPICodePack.Shell.dll" Source="$(var.NACViewAgent.TargetDir)Microsoft.WindowsAPICodePack.Shell.dll"/>
</Component>
<Component Id="Microsoft.WindowsAPICodePack.ShellExtensions.dll" Guid="MYGUID">
<File Id="Microsoft.WindowsAPICodePack.ShellExtensions.dll" Name="Microsoft.WindowsAPICodePack.ShellExtensions.dll" Source="$(var.NACViewAgent.TargetDir)Microsoft.WindowsAPICodePack.ShellExtensions.dll"/>
</Component>
<!--Tell WiX to install the shortcut-->
<ComponentRef Id="ApplicationShortcut"/>
<ComponentRef Id="ApplicationAutostart"/>
</ComponentGroup>
</Fragment>
</Wix>
build wix project and install it, then I can see NACViewAgent value in Run key like below.
I restarted my machine.
but unfortunately my exe does not auto start when windows boots.
Thanks in advance!
With the new release of .NET Core 3, I am trying to make a windows service with the new worker service template. I need to be able to install this with group policy, and WiX seems to be the tool for the job.
I've created the .wxs file and without specifying the ServiceInstall section, it installs fine.
Here's my file: UPDATED
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SystemInformationService" Language="1033" Version="1.0.0.0" Manufacturer="MyCompany" UpgradeCode="f08191cf-461e-481b-a2a1-6f54d6ae5331">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!-- Embed cab files, don't include them in the output -->
<MediaTemplate EmbedCab="yes"/>
<!-- Default WiX dialog set -->
<UIRef Id="WixUI_Mondo" />
<!-- License agreement -->
<WixVariable Id="WixUILicenseRtf" Value="LicenseAgreement.rtf" />
<Feature Id="ProductFeature" Title="SystemInformationService.Setup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="HeatGenerated" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SystemInformationService" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent" Guid="5BB7300D-C29F-4C87-B461-AAE3AA4EB56D">
<CreateFolder/>
<!--<File Source="$(var.SystemInformationService.TargetPath)" />-->
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Name="SystemInformationService"
DisplayName="System Information Service"
Description="System Information service by MyCompany"
Start="auto"
Vital="no"
Account="LocalSystem"
Interactive="no"
ErrorControl="normal" />
<ServiceControl
Id="ServiceInstaller"
Start="install"
Stop="both"
Remove="uninstall"
Name="SystemInformationService"
Wait="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Now I'm trying to add the service components so that it will start on install. When I run the installer after adding it, the installer UI hangs on 'Starting Service...'. I tried adding the 'start' arguments since I saw that on another answer.
I'm thinking since this is .net core, I might need to add an action .exe or something to start the service. That's all I can think of - any suggestions will help.
Thanks
UPDATE: I've updated the .wxs file to what I now have, and I have it correctly installing with a framework dependent deployment. My problem was specifying AnyCPU instead of x86. But... Now when I switch to a self-contained deployment I get the same error as before. So It must be something to do with how I'm publishing the .net core.
This is my publish profile currently. When i switch to framework dependent the installer runs fine and starts the service.
Figured it out. What I was missing was the .exe of the service must be defined above the 'ServiceInstall' and 'ServiceControl' tags in the .wxs. So what I needed to do was create a filter .xslt to filter the .exe out of the heat generated file, then add a tag to the Service component (with keypath='yes') above ServiceInstall.
Below is my final .wxs and .xslt
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SystemInformationService" Language="1033" Version="1.0.2.0" Manufacturer="MyCompany" UpgradeCode="f08191cf-461e-481b-a2a1-6f54d6ae5331">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="f08191cf-461e-481b-a2a1-6f54d6ae5331">
<UpgradeVersion
Minimum="1.0.0" Maximum="99.0.0"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<MajorUpgrade DowngradeErrorMessage="A newer version of System Information Service is already installed." />
<!-- Embed cab files, don't include them in the output -->
<MediaTemplate EmbedCab="yes"/>
<!-- Default WiX dialog set -->
<UIRef Id="WixUI_Minimal" />
<!-- License agreement -->
<WixVariable Id="WixUILicenseRtf" Value="LicenseAgreement.rtf" />
<Feature Id="ProductFeature" Title="SystemInformationService.Setup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="HeatGenerated" />
</Feature>
<!--<CustomAction Id="installService" Directory="INSTALLFOLDER" Execute="commit" ExeCommand="sc create SystemInformationService binPath=INSTALLFOLDER/SystemInformationService.exe" Return='ignore'/>
<CustomAction Id="testAction" Directory="INSTALLFOLDER" Execute="commit" ExeCommand="notepad.exe test.txt" Return='ignore'/>
<CustomAction Id="startService" Directory="INSTALLFOLDER" Execute="commit" ExeCommand="sc start binPath=INSTALLFOLDER/SystemInformationService.exe" Return='ignore'/>-->
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SystemInformationService" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent" Guid="5BB7300D-C29F-4C87-B461-AAE3AA4EB56D">
<!--<File Source="$(var.SystemInformationService.TargetPath)" />-->
<!--<CreateFolder/>-->
<File Id="SystemInformationService" KeyPath="yes" Source="..\SystemInformationService\bin\Release\netcoreapp3.0\win-x86\SystemInformationService.exe"/>
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Name="SystemInformationService"
DisplayName="System Information Service"
Description="System Information service by MyCompany"
Start="auto"
Account="LocalSystem"
ErrorControl="normal" />
<ServiceControl
Id="ServiceInstaller"
Start="install"
Stop="both"
Remove="uninstall"
Name="SystemInformationService"
Wait="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<xsl:output method="xml" indent="yes" />
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:key name="exe-search" match="wix:Component[contains(wix:File/#Source, 'SystemInformationService.exe')]" use="#Id" />
<xsl:template match="wix:Component[key('exe-search', #Id)]" />
<xsl:template match="wix:ComponentRef[key('exe-search', #Id)]" />
</xsl:stylesheet>
I crated a service in C# with Viwual Studio 2017.
Now I'm trying to create an installer with Wix. It's not my first time with wix, but this time I can't build my setup. I have error :
Unresolved reference to symbol 'Component:InstallComponents' in
section 'Product:*'.
I saw some topic about this, but it did not solve my problem.
There is my product.wxs :
<?xml version="1.0" encoding="UTF-8"?>
<?define compagny = "myCompagny"?>
<?define product = "Service Name"?>
<?define service = "MyService"?>
<?define version = "!(bind.FileVersion.MyService.exe)"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="$(var.product)"
Language="1033"
Version="$(var.version)"
Manufacturer="$(var.compagny)"
UpgradeCode="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Media Id="1" Cabinet="MyService.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="CGYFOLDER" Name="$(var.compagny)">
<Directory Id="INSTALLFOLDER" Name="$(var.product)" />
</Directory>
</Directory>
</Directory>
<ComponentGroup Id="InstallComponents">
<Component Id="InstallService" Guid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX" Directory="INSTALLFOLDER">
<File Id="MyService.exe.config"
Name="$(var.service).exe.config"
Source="$(var.MyService.TargetDir)\$(var.service).exe.config"
Vital="yes"/>
<RemoveFile Id="ALLFILES" Name="*.*" On="both" />
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="$(var.service)"
DisplayName="$(var.product)"
Description=""
Start="auto"
Account="LocalSystem"
ErrorControl="normal" />
<ServiceControl Id="Service_Start" Name="MyService" Start="install" Wait="no" />
<ServiceControl Id="Service_Stop" Name="MyService" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
</ComponentGroup>
<!-- Tell WiX to install the files -->
<Feature Id="ProductFeature" Title="$(var.product)" Level="1">
<ComponentRef Id="InstallComponents" />
</Feature>
</Product>
</Wix>
InstallComponents exists in ComponentGroup, I don't understand why I have this error.
The mistake was in my Feature.
My InstallComponents is define as ComponentGroup, so to install it, my feature must be like this :
<Feature Id="ProductFeature" Title="$(var.product)" Level="1">
<ComponentGroupRef Id="InstallComponents" />
</Feature>
trying to make an installer wit multi language support, i know i have to use a boostrapper. But when i wanted to make a test file, it will freeze.
My main is just a simple form that will display a "hello world" text.
The SetupProject is also the basic XML.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="cbb7c280-e909-4a3c-9aab-76f6a4cc75e5">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="SetupProject" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupProject" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source="$(var.cs_tt10_bundle.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
The Bootsrapper file is
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Name="Bootstrapper" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="e7d3169f-9d31-4849-b75d-567c796b19f8">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<MsiPackage Compressed="yes" Vital="yes" SourceFile="$(var.SetupProject.TargetPath)" />
</Chain>
</Bundle>
</Wix>
When i compile everything i get the .exe but when i try to run it, it hangs.
No process explorer can close it. It locks the file and the only way (i know) to "kill" the program is restarting the machine.
I have no idea how to debug the bootstrapper...