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.
Related
I'm trying to register app to autorun when Windows is launches. I can't understand why it doesn't work?
I'm trying to do that:
<!-- Files.wxs -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:fw="http://schemas.microsoft.com/wix/FirewallExtension"> <Fragment>
<DirectoryRef Id="INSTALLLOCATION"
FileSource="..\MyApp\bin\Release\">
<Component Id ="ProductComponents"
DiskId="1"
Guid="{482A3E9A-8FCA-44C6-96C5-F7B026DF85C4}">
<File Id="MyApp.exe.config" Name="MyApp.exe.config"/>
<File Id="MyApp.exe" Name="MyApp.exe"/>
<RegistryKey
Root="HKLM"
Key="Software\Microsoft\Windows\CurrentVersion\Run">
<RegistryValue Id="MyApp.exe" Name="MyApp" Value="[INSTALLLOCATION]MyApp.exe" Type="string" />
</RegistryKey>
</Component>
</DirectoryRef>
</Fragment>
</Wix>
<!-- Product.wxs -->
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include Variables.wxi?>
<Product Id="*"
Name="$(var.ProductName)"
Language="1033"
Version="$(var.Version)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="MY_GUID">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<WixVariable Id="WixUILicenseRtf" Value="eula.rtf" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<MajorUpgrade
AllowDowngrades="no"
DowngradeErrorMessage="New version is already installed."
AllowSameVersionUpgrades="no"
Schedule="afterInstallInitialize"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="MyApp" />
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="MyApp" Level="1">
<ComponentRef Id="ProductComponents" />
</Feature>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION"></Property>
<UIRef Id="WixUI_InstallDir"/>
<CustomAction Id="LaunchApp" Directory="INSTALLLOCATION" ExeCommand="[SystemFolder]cmd.exe /C start MyApp.exe" />
<InstallExecuteSequence>
<Custom Action="LaunchApp" After="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
</InstallExecuteSequence>
</Product>
</Wix>
I want to achieve auto start myApp.
The most likely issue is that it needs elevation and therefore will be blocked by UAC:
https://blogs.msdn.microsoft.com/uac/2006/08/23/elevations-are-now-blocked-in-the-users-logon-path/
and:
Program needing elevation in Startup registry key (windows 7)
If it's not that, then check that the path in the registry Run key is actually correct (in the 32-bit or 64-bit registry).
Entries in the Run key do not run "when Windows is launched". They start when the user logs on. If you really want something to run when Windows starts you need a service or a Task Scheduler entry that starts when Windows starts.
I am attempting to build an installer with wix.
It compiles and runs. Unfortunately when I run it, I accept the license agreement and hit next, then it explodes.
Error
"The installer has encountered an unexpected error installing this
package. This may indicate a problem with this package. The error code
is 2819."
Here is the code I am using
Code
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="rd Installer" Language="1033" Version="1.0.0.0" Manufacturer="hs" UpgradeCode="upgradeCode">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="rd">
<Directory Id="BINFOLDER" Name="Bin"/>
<Directory Id="IMAGEFOLDER" Name="Image"/>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="CMP_rd1" Guid="guid">
<File Id="rd1"
Name="r.d"
Source="D:\dir\file.txt"
KeyPath="yes">
</File>
</Component>
<Component Id="CMP_rd2" Guid="guid">
<File Id="rd2"
Name="r.d"
Source="D:\dir\file.txt"
KeyPath="yes">
</File>
</Component>
</DirectoryRef>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="CMP_rd1"/>
<ComponentRef Id="CMP_rd2"/>
</Feature>
<UI Id="UI_ReportDasboard">
<UIRef Id="WixUI_InstallDir"/>
</UI>
</Product>
</Wix>
I've looked at a number of examples and I cant seem to understand what's wrong. My code looks very close to the examples I've seen. Am I missing something?
You need to set the WIXUI_INSTALLDIR property.
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
More info here
I was receiving the error 2819 having
<Control Id="SelectWebSiteList" Type="ListBox" X="20" Y="75" Width="200" Height="150" Sorted="yes" Property="WEBSITE" />
without
Property="WEBSITE"
I am trying to install some files to WindowsFolder. Here is the markup:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="MyAppSetup" Language="1033" Version="1.0.0.0" Manufacturer="abc" UpgradeCode="C313D73A-0FE5-496C-BD86-C21565BD65ED">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="MyAppSetup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WindowsFolder">
<Directory Id="INSTALLFOLDER" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="myApp1" Guid="13B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
<File Id="myApp.pdb" Source="myApp64.pdb" KeyPath="yes" />
</Component>
<Component Id="myApp2" Guid="23B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
<File Id="myApp.sys" Source="myApp64.sys" KeyPath="yes" />
</Component>
<Component Id="myApp3" Guid="33B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
<File Id="myAppsvc.exe" Source="myAppsvc64.exe" KeyPath="yes" />
</Component>
<Component Id="myApp4" Guid="43B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
<File Id="myAppsvc.pdb" Source="myAppsvc64.pdb" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Based on my reading, this directory element specifies the files to be installed/copied under WindowsFolder (on my machine C:\windows), but instead, it installs files to D:\ which has the most space. So the question is : what did I do wrong on the directory?
It turns out that the Directory reset happens when the msi is launched through msiexec using /a (admin) option. Here is a few log entries show this:
PROPERTY CHANGE: Adding TARGETDIR property. Its value is 'D:\'.
PROPERTY CHANGE: Modifying WindowsFolder property. Its current value is 'C:\windows\'. Its new value: 'D:\'.
PROPERTY CHANGE: Adding APPLICATIONROOTDIRECTORY property. Its value is 'D:\'.
If msi is launched using /i option, then the Directory reset is not happening. Since package needs to be installed with elevated privilege, the correct way to do this is using /i option in a elevated CMD console. The markup was never the issue.
I am having trouble understanding wix documentation. I have created a simple installer that allows user to select a destination folder for app. It looks something like this:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="AppName" Language="1033" Version="1.0.0.0" Manufacturer="Manufacturer" UpgradeCode="guid">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SetupProjectFeature" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UIRef Id="WixUI_InstallDir"/>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="OeeCoach" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Insert files, registry keys, and other resources here. -->
<Component Id="EntityFramework" Guid="guid">
<File Id="EntityFramework.dll" Source="../App/bin/Release/EntityFramework.dll" KeyPath="yes" />
</Component>
<Component Id="MvvmLight.Extras" Guid="guid">
<File Id="GalaSoft.MvvmLight.Extras.WPF4.dll" Source="../App/bin/Release/GalaSoft.MvvmLight.Extras.WPF4.dll" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Now I need to check for .net 4 and its prerequisites, but I could not understand hot to do this. Documentation says that I need to use Bundle element, but compiler seems to complain when it is together with Product element in same wix file.
Any help is appreciated.
The bootstrapper is a separate project from your setup project. If you are using Visual Studio, add a new project to your solution and choose Bootstrapper project (instead of Setup project).
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).