I am brand new to WIX and trying to create an MSI to install a service. The Setup project is producing a .wixlib object instead of an msi. I am working off of this example.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- TODO: Put your code here. -->
<Product Name="Smart Elf Service"
Id="*"
UpgradeCode="927E7BBE-58C0-4832-A821-24A6B19AEE63"
Version="1.0.0.0"
Manufacturer="Me!"
Language="1033">
<Package
Manufacturer="Me!"
InstallerVersion="100"
Languages="1033" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="Program Files(x86)">
<Directory Id="CorporationFolder" Name="Corporation">
<Directory Id="SmartElfFolder" Name="SmartElf Service">
<Component Id="SmartElfService">
<File Id="SmartElfServiceBinary" Name="ElfVerificationService.exe" Source ="..\ElfVerificationService\bin\debug\ElfVerificationService.exe" KeyPath="yes" Vital="yes"/>
<ServiceInstall
Id="SI_SmartElfService"
Vital="yes"
Name="sesvc"
DisplayName="SmartElf Service"
Start="auto"
ErrorControl="normal"
Type="ownProcess"
/>
<ServiceControl
Id="SC_SmartElfService"
Name="sesvc"
Start="install"
Stop="both"
Remove="uninstall"
Wait="yes"
/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="SmartElfService"/>
</Feature>
</Product>
</Wix>
Right-click on the project in Solution Explorer and select Properties. Make sure the output type is set to Windows Installer Package (.msi).
Related
I am using WIX installer for my application everything working fine but when I uninstall the application the desktop icon and startmenu icon is still there.
Whats wrong with my xml. followed the steps given by Wix documentation.
help..
XML:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="applicationName" Language="1033" Version="1.0.0.0" Manufacturer="manufacturerName" UpgradeCode="PUT-GUID-HERE">
<Package Id="*" InstallerVersion="201" Compressed="yes" InstallScope="perMachine" Comments="Windows Installer Package" ReadOnly="yes" InstallPrivileges="elevated" />
<Feature Id="ProductFeature" Title="applicationName" Level="1">
<ComponentRef Id="Permission.INSTALLFOLDER" />
<ComponentRef Id="ApplicationDeskShortcutComp" />
<ComponentGroupRef Id="HeatGenerated" />
</Feature>
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="CompanyNameFolder" Name="CompanyName">
<Directory Id="INSTALLFOLDER" Name="applicationName">
<Component Id="Permission.INSTALLFOLDER" Guid="*">
<CreateFolder>
<Permission User="Everyone" GenericAll="yes" />
</CreateFolder>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="applicationName" />
</Directory>
</DirectoryRef>-->
<!--Add the shortcut to installer package For DeskTop-->
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationDeskShortcutComp" Guid="*" Win64="yes" >
<Shortcut Id="ApplicationDeskShortcut" Name="applicationName" Description="applicationName" Target="[INSTALLFOLDER]exeName.exe" WorkingDirectory="DesktopFolder" Icon="IconName.exe" >
</Shortcut>
<RemoveFolder Id="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Manufacturer\ProductName" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<Property Id="MYWIXUI_MONDO" Value="INSTALLFOLDER" />
<UIRef Id="MyWixUI_Mondo" />
<Icon Id="IconName.exe" SourceFile=".\Icons\MainLogo.ico" />
<Property Id="ARPPRODUCTICON" Value="IconName.exe" />
</Wix>
No time to test this right now, but could you first please try to change this:
<Directory Id="DesktopFolder" Name="applicationName" />
into this:
<Directory Id="DesktopFolder" />
DesktopFolder is a built-in Windows Installer folder that should resolve to the user's desktop folder or the common desktop folder for all users depending on the setting for ALLUSERS (per-machine or per-user installation).
During installation, MSI directory resolution (costing) will assign the correct value to DesktopFolder for the system you are running on (based on ALLUSERS setting). I thought anything you assign to DesktopFolder yourself in your WiX source would be wiped out as soon as directory resolution has run, so there is no direct logical reason why the above WiX markup change suggestion should work, but I think it should be tested. Please test on a clean virtual, if available.
I'm trying to build a very simple installer that just installs the package as a "per-user" application. No dialogs, just always install into the local app data folder. And it's ignoring me. And always installing to C:\Program Files.
I've set the InstallScope to "perUser", but left the installation directory as "ProgramFilesFolder". The documentation seems to suggest that that SHOULD get redirected, but that isn't happening.
Setup file below...
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="MyApplication"
Language="1033"
Version="1.0.0"
Manufacturer="MyCompany"
UpgradeCode="19E4E10A-558C-4D4A-BD2A-D6B8060FB917">
<Package
InstallerVersion="500"
Compressed="yes"
InstallPrivileges="limited"
InstallScope="perUser" />
<MajorUpgrade
DowngradeErrorMessage="A newer version of MyApplication is already installed." />
<MediaTemplate
EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyCompany MyApplication">
<Directory Id="JreFolder" Name="jre"/>
<Directory Id="LibFolder" Name="lib"/>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="MyCompany MyApplication"/>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLDIR">
<Component Id="CMP_MyApplication.exe">
<File Id="FILE_MyApplication.exe" Source="MyApplication.exe" KeyPath="yes"/>
</Component>
<Component Id="CMP_MyApplication.ini">
<File Id="FILE_MyApplication.l4j.ini" Source="MyApplication.l4j.ini" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="CMP_StartMenuShortcut" Guid="0B96A876-70FB-4E8E-8D27-B9B1E40C9B4D">
<Shortcut Id="ApplicationStartMenuShortcut" Name="MyCompany MyApplication" Description="MyCompany MyApplication"
Target="[#FILE_MyApplication.exe]" WorkingDirectory="INSTALLDIR"/>
<RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\MyCompany\MyApplication" Name="Installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Main Application" Level="1" >
<ComponentGroupRef Id="JreGroup"/>
<ComponentGroupRef Id="LibGroup"/>
<ComponentRef Id="CMP_MyApplication.exe"/>
<ComponentRef Id="CMP_MyApplication.ini"/>
<ComponentRef Id="CMP_StartMenuShortcut"/>
</Feature>
</Product>
</Wix>
If you know that you want to install to the app data folder why use the 'ProgramFilesFolder'?
This will only confuse you (or any other person that will maintain your code) - try using the 'AppDataFolder' instead.
I'm aware of similar questions inside stackoverflow:
WIX:default directory in WixUI_InstallDir,
WIX installer root directory and versioning,
Is it possible to have two root directories in WIX,
copy file to custom dir in another partition,
How to create a directory in wix?
however none of them shows a simple and immediate code to create a folder inside the C:\ folder (not hard coded but should be the root disk or system disk or whatever you would call the disk which contains the Windows folder) and to copy files inside it.
In other words how can Wix create a C:\MynewDir\example.jar folder?
Here's what I tried:
<?xml version="1.0" encoding="UTF-8"?>
<!-- WiX installer MyProgram by Mark Seuffert -->
<?define ProductVersion = "13.1.2.3"?>
<?define ProductUpgradeCode = "12345678-1234-1234-1234-111111111112"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="$(var.ProductUpgradeCode)" Name="MyProgram" Version="$(var.ProductVersion)" Manufacturer="COMPANY" Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyProgram">
<Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222">
<File Id="ApplicationFile1" Source="C:\Users\user\Desktop\myprogram.exe" />
</Component>
</Directory>
</Directory>
<Directory Id="ANOTHERLOCATION" FileSource="C:\MynewDir">
</Directory>
</Directory>
<DirectoryRef Id="ANOTHERLOCATION" FileSource="C:\MynewDir">
<Component Id="ApplicationFiles2" Guid="12345678-1234-1234-1235-111111111111">
<File Id="ApplicationFile2" Source="C:\Users\user\Desktop\InstallerFiles_13_4_9_3\myprogramLauncher.jar" />
<CreateFolder />
</Component>
</DirectoryRef>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate" />
</InstallExecuteSequence>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles2" />
<ComponentRef Id="ApplicationFiles" />
</Feature>
</Product>
</Wix>
EDIT 1:
Yan Sklyarenko just found what I was looking for, that's the WindowsVolume (I don't know how I missed it inside http://msdn.microsoft.com/en-us/library/windows/desktop/aa370905%28v=vs.85%29.aspx#system_folder_properties microsoft document).
However how do I replace FileSource="C:\MynewDir" with FileSource="[WindowsVolume]MynewDir" ??? because apparently even with WINDOWSVOLUME the resulting volume chosen is always D:\ in my computer which has more available space :(
EDIT 2 I updated my code using Yan Sklyarenko's second sample ( ####newpart#### identifies parts where code differs), however behaviour is still the same, the installer chooses the disk with more free space (D:\ in my case) and not C:\ where windows is..
<?xml version="1.0" encoding="UTF-8"?>
<!-- WiX installer MyProgram by Mark Seuffert -->
<?define ProductVersion = "13.1.2.3"?>
<?define ProductUpgradeCode = "12345678-1234-1234-1234-111111111112"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="$(var.ProductUpgradeCode)" Name="MyProgram" Version="$(var.ProductVersion)" Manufacturer="COMPANY" Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyProgram">
<Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222">
<File Id="ApplicationFile1" Source="C:\Users\user\Desktop\myprogram.exe" />
</Component>
</Directory>
</Directory>
<Directory Id="ANOTHERLOCATION" FileSource="C:\MynewDir">
####newpart####<Component Id="ApplicationFiles2" Guid="12345678-1234-1234-1235-111111111111">
<File Id="ApplicationFile2" Source="C:\Users\user\Desktop\InstallerFiles_13_4_9_3\myprogramLauncher.jar" />
<CreateFolder />
</Component>
</Directory>
</Directory>
####newpart####<SetDirectory Id="ANOTHERLOCATION" Value="[WINDOWSVOLUME]" />
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate" />
</InstallExecuteSequence>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles2" />
<ComponentRef Id="ApplicationFiles" />
</Feature>
</Product>
</Wix>
EDIT 3 The last code snippet above should work however change the casing of WINDOWSVOLUME to WindowsVolume as suggested.
Here is a complete working solution based on your code simplified (notice the comment in the code):
<?define ProductVersion = "13.1.2.3"?>
<?define ProductUpgradeCode = "12345678-1234-1234-1234-111111111112"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="$(var.ProductUpgradeCode)" Name="MyProgram"
Version="$(var.ProductVersion)" Manufacturer="COMPANY" Language="1033">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyProgram" />
<Directory Id="ANOTHERLOCATION" />
</Directory>
</Directory>
<!-- The casing of 'ANOTHERLOCATION' and 'WindowsVolume' is very important here.
Replace 'MyNewDir' with the correct name of the folder you want on
WindowsVolume.
-->
<SetDirectory Id="ANOTHERLOCATION" Value="[WindowsVolume]MyNewDir" />
<Feature Id="DefaultFeature" Level="1">
<Component Directory="INSTALLDIR">
<File Id="ApplicationFile1" Source="C:\Users\user\Desktop\myprogram.exe" />
</Component>
<Component Directory="ANOTHERLOCATION">
<File Id="ApplicationFile2" Source="C:\Users\user\Desktop\InstallerFiles_13_4_9_3\myprogramLauncher.jar" />
</Component>
</Feature>
</Product>
</Wix>
Ok, you can do something like this:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WindowsVolume">
<Directory Id="MyNewDirId" Name="MyNewDir">
<Component Id="SampleComponent" Guid="...">
<File Id="SampleFile" Source="..." KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Directory>
This will install the file to the MyNewDir folder on Windows drive (C: in my case).
However, it will complain that using WindowsVolume in this fashion might have unexpected side effects.
To satisfy that validation, you can change the sample to:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MyNewDirId" Name="MyNewDir">
<Component Id="SampleComponent" Guid="...">
<File Id="SampleFile" Source="..." KeyPath="yes" />
</Component>
</Directory>
</Directory>
<SetDirectory Id="MyNewDirId" Value="[WindowsVolume]MyNewDir" />
This looks more like a hack, but the result is the same.
To be honest, I don't understand what those "unexpected side effects" could be. Maybe, Windows Installer gurus can shed some light on this.
Hope this helps.
I am new to WIX. In fact, this is my first project. So it should not be surprising that I am having issues.
I had my installer all setup and ready to roll, but this morning I needed a change made to my service, so I made the change and compiled. I build the WIX project and installed it. I started my service up and ran it, but the old code was executed. As it turns out, the old version of my service is still installed. Does this mean that the new version of the service was not packaged or that there was some kind of upgrade rule that I am missing? For some reason the PDB file got updated, but not the EXE.
Below is my wxs file. Please be kind...
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define AppName="My Service"?>
<?define MfgName="My Company"?>
<?define SourcePath="..\My Service\bin\$(var.Configuration)"?>
<Product Name="$(var.AppName)" Language="1033" Version="1.0.0.0" Manufacturer="$(var.MfgName)"
Id="*" UpgradeCode="063de86b-f12b-4af1-91ff-ce0917fffd5c" Codepage="1252">
<Package Id="*" Keywords="Installer" Description="$(var.AppName) Installer"
Manufacturer="$(var.MfgName)" Comments="My Service blah blah blah"
InstallerVersion="200" Compressed="yes" InstallScope="perMachine" SummaryCodepage="1252" />
<!--
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
-->
<Media Id="1" Cabinet="setup.cab" EmbedCab="yes" DiskPrompt="CD-ROM #1"/>
<Property Id="DiskPrompt" Value="$(var.AppName) Installer [1]"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="CompanyFolder" Name="$(var.MfgName)">
<Directory Id="INSTALLFOLDER" Name="$(var.AppName)">
<Component Id="ServiceFile" Guid="3688d9ee-08ed-4dde-87d8-3b7a752a99bf">
<File Id="ServiceEXE" Name="My Service.exe" DiskId="1" Source="$(var.SourcePath)\My Service.exe" KeyPath="yes" Vital="yes" />
<File Id="ServicePDB" Name="My Service.pdb" DiskId="1" Source="$(var.SourcePath)\MY Service.pdb" KeyPath="no" Vital="yes"/>
<File Id="LibraryDLL" Name="library.dll" DiskId="1" Source="$(var.SourcePath)\library.dll" KeyPath="no" Vital="yes"/>
<File Id="LibraryPDB" Name="library.pdb" DiskId="1" Source="$(var.SourcePath)\library.pdb" KeyPath="no" Vital="yes"/>
<File Id="Config" Name="My Service.exe.config" DiskId="1" Source="$(var.SourcePath)\My Service.exe.config" KeyPath="no" Vital="yes"/>
<ServiceInstall Id="InstallService" Name="MyService" Type="ownProcess" ErrorControl="normal" Start="auto"
DisplayName="$(var.AppName)" Description="My Service blah blah blah">
<ServiceConfig OnInstall="yes" DelayedAutoStart="yes" />
</ServiceInstall>
<ServiceControl Id="ControlService" Name="MyService" Remove="both" Stop="both" Wait="no"/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="MainFeature" Title="$(var.AppName) Setup" Level="1">
<ComponentRef Id="ServiceFile"/>
</Feature>
</Product>
</Wix>
If the installation was successful yet the file was not updated, you should log the install to see why. For example:
msiexec /i filename.msi /lvoicewarmupx log.txt
One reason for a file to not get updated is if Windows Installer checks the version of the existing file and it is newer than the version of the file you are trying to install.
When I try to use merge module feature in VS2010, I am getting an issue "Multiple Section entery"
Why i am getting this error?
I have done googling but I did not get any thread where i got my answer.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Module Id="ModuleTest" Language="1033" Version="1.0.0.0">
<Package Id='94290AA7-50E3-414E-A1BD-FC3C2B0C47D8' Description='My first Merge Module'
Comments='This is my first attempt at creating a Windows Installer Merge Module'
Manufacturer='TravelPort Private Limited' InstallerVersion='200' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='MyModuleDirectory' Name='.'>
<Component Id='MyModuleComponent' Guid='93F36B4B-B6E0-4000-8174-2660C0AE9D6A'>
<File Id='readme' Name='ReadMeModule' Source='ReadMergeModule.txt' DiskId='1' KeyPath='yes' Checksum='yes'></File>
</Component>
</Directory>
</Directory>
</Module>
</Wix>
product.wxs file
<Product Id="ec20ec5e-bb50-45d0-9190-156cf146c8f3" Name="WinDemoApp" Language="1033" Version="1.0.0.0" Manufacturer="WinDemoApp" UpgradeCode="979e03f4-3b50-43c1-9dde-dd675f726fde">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="WinDemoApp">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
</Directory>
<Directory Id ="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="WinDemoApp"></Directory>
</Directory>
<!--<Merge Id='MyModule' Language='1033' SourceFile='Module.msm' DiskId='1' />-->
</Directory>
</Directory>
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="MyApp.exe" Guid="36AA7C63-ED57-40C6-8B14-843B9355C265">
<File Id="MyApp.exe" Source="D:\WIXDemo\WinDemoApp\MyApp\bin\Debug\MyApp.exe" KeyPath="yes" Checksum="yes"></File>
</Component>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="EA549460-4D98-4B09-B621-D4F1AA12A617">
<Shortcut Id="ApplicationStartMenuShortcut" Name="WinDemoApp"
Description="My Win Installer sample"
Target="[APPLICATIONROOTDIRECTORY]MyApp.exe"
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
<RemoveFolder Id ="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\WinDemoApp" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!--<Icon Id="bug.ico" SourceFile="bug.ico"/>
<Property Id="ARPPRODUCTICON" Value="bug.ico" />-->
<Feature Id="MyApplication" Title="WinDemoApp" Level="1">
<!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
<ComponentRef Id="MyApp.exe"/>
<ComponentRef Id="ApplicationShortcut"/>
<!--<MergeRef Id="MyModule"/>-->
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
</Feature>
</Product>
The MyModuleDirectory directory element shouldn't have a name attribute. Also your Merge element should probably be nested underneath the ApplicationProgramsFolder directory. Where it's now it'll go to [ProgramFilesFolder].
Take a look at Industrial Strength Windows Installer XML.
Even if you don't want to use the tool, it's own installer is setup exactly the way you are setting up yours with merge modules consumed by a product.