I have a Wix Setup of my .Net appplication.I have installed it on my system.
I want to create a WIX setup with UpgradeVesion to remove some feaures from the installed setup and add new features.
i use the below code:-
<Product Id="*"
Name="MyProduct"
Language="10313"
Version="3.0.0.0"
Manufacturer="My_Company"
UpgradeCode="6ba277d97-41de-4371-a236-b757b7840f7b">
<Package InstallerVersion="200" Compressed="yes" />
<Upgrade Id="6ba28d97-49de-4371-a236-b757b7840f7b">
<UpgradeVersion Minimum="0.0.0.0"
IncludeMinimum="yes"
OnlyDetect="no"
Maximum="3.0.0.0"
IncludeMaximum="yes"
Property="PREVIOUSFOUND" RemoveFeatures="[ProductFeature1]"/>
</Upgrade>
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize"/>
</InstallExecuteSequence>
<MediaTemplate />
<UIRef Id="WixUI_InstallDir" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"/>
<Feature Id="ProductFeature" Title="TestApp" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<Feature Id="ProductFeature1" Title="TestApp" Level="1">
<ComponentGroupRef Id="ProductComponent1"/>
</Feature>
</Product>
But i am unable to remove the ProductFeature1.
How can i remove an existing feature from the installed setup.
You need to create Major upgrade for wix to achieve the same..
follow the below link:-
enter link description here
Related
I am using the Wix Toolset to generate an .msi for my application. Everything works when I upgrade to a new version, except every time I run a newer version installation the setup doesn't detect already installed features and instead defaults to the features that are 'required' which means if the user installed any of the other features they are removed unless the user explicitly checks them for installation again.
Is there anyway to have the .msi detect which features are currently installed each time a newer version is installed?
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" UpgradeCode="9e578e3d-0119-425c-8633-f54ffaaa4929" Name="#product.name#" Version="#product.version#" Manufacturer="#product.company#" Language="1033">
<Package InstallerVersion="400" Compressed="yes" InstallScope="perMachine" Comments="#product.version#" Description="#product.description#"/>
<Media Id="1" Cabinet="myapp.cab" EmbedCab="yes" />
<!-- Installer Properties -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<PropertyRef Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED"/>
<!-- Check Existing Install -->
<Upgrade Id="9e578e3d-0119-425c-8633-f54ffaaa4929">
<UpgradeVersion Minimum="#product.version#" OnlyDetect="yes" Property="NEWERVERSIONDETECTED"/>
<UpgradeVersion Minimum="0.0.0" Maximum="#product.version#" IncludeMinimum="yes" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED"/>
</Upgrade>
<Condition Message="A newer version of this software is already installed.">NOT NEWERVERSIONDETECTED</Condition>
<!-- Prerequisites -->
<Condition Message="This application requires .NET Framework 4.6 or newer. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED]]>
</Condition>
<Condition Message="This application is only supported on Windows 7, Windows Server 2008 R2 or higher.">
<![CDATA[Installed OR (VersionNT >= 601)]]>
</Condition>
...
<Feature Id="Feature_Application"
Title="Application"
ConfigurableDirectory="APPLICATIONDIR"
Level="1"
AllowAdvertise="no">
#product.applicationcomponents#
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="CleanupApplicationData" />
</Feature>
<!-- Feature: My Service -->
<Feature Id="Feature_Service"
Title="My Service"
Description="My Service"
ConfigurableDirectory="REPORTDIR"
Level="3"
AllowAdvertise="no">
#product.servicecomponents#
<ComponentRef Id="ServiceShortcut" />
<Component Id="MyServiceInstaller_ServiceControl" Guid="B72CAA3F-F2DB-48D2-90DD-061209AB2CE5" Directory="REPORTDIR">
<CreateFolder />
<File Id="MyService.exe" Name="MyService.exe" KeyPath="yes" Source="#product.sourcedir#\MyService\MyService.exe"/>
<ServiceInstall Id="MyServiceInstaller_ServiceInstall"
Type="ownProcess"
Vital="yes"
Name="Windows Service"
DisplayName="Windows Service"
Description="Windows service"
Start="auto"
Account="NT AUTHORITY\LocalService"
ErrorControl="ignore"
Interactive="no" />
<ServiceControl Id="MyServiceInstaller_ServiceInstall"
Name="My Service"
Stop="both"
Remove="uninstall"
Wait="yes" />
</Component>
</Feature>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate"/>
</InstallExecuteSequence>
<UIRef Id="WixUI_FeatureTree" />
<UI>
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<!-- Add the GUI logic for installation -->
</UI>
</Product>
#dpb's answer would solve the problem, because the MajorUpgrade tag has a MigrateFeatures attribute with an implicit default value of yes.
However, it is only relevant if you actually want to create a major update to your product, which has implications. - This is not an option for me.
If you do not want to perform a major update, you must add the MigrateFeatures attribute to the UpgradeVersion tag and explicitly set it's value to yes.
The MigrateFeatureStates action below the InstallExecuteSequence tag is of minor importance only.
This action will not be executed if there is no MigrateFeatures="yes" attribute (implicit or explicit), as described above.
If there is a MigrateFeatures="yes" attribute, the MigrateFeatureStates action will automatically be added to the InstallExecuteSequence table of the installer.
You only need to explicitly define the MigrateFeatureStates action in the InstallExecuteSequence tag, if you want to adjust the action's position in the execution sequence.
Try using MajorUpgrade tag.
`<MajorUpgrade DowngradeErrorMessage="Can’t downgrade." />`
https://stackoverflow.com/a/11028847/7165196
I have an application that needs 1. to create DLL files in a Program Files subfolder (e.g. C:\Program Files (x86)\myapp), and 2. to create a registry entry in HKCU. When I run the Remove, I need this subfolder and its files to be deleted, as well as the registry entry.
When I run the installation file of a newer version, I need the new DLL files to replace the existing ones.
I've been struggling getting it to work, having tried several tips from various threads and sites.
So far I get the Program Files to be removed but not the Registry. And I cannot get the file upgrade to work (I change the UpgradeCode & ProductVersion for each new release)
Here is an extract of what I have
<Product Id="$(var.ProductID)"
Name="myapp"
Language="1033"
Version="$(var.ProductVersion)"
UpgradeCode="$(var.UpgradeCode)"
Manufacturer="$(var.Manufacturer)">
<Package Description="Windows installer for myApp $(var.ProductVersion)"
Comments="Execute to install myApp $(var.ProductVersion)"
InstallerVersion="200"
Compressed="yes" />
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)"
OnlyDetect="yes"
Property="NEWERVERSIONDETECTED" />
<UpgradeVersion Minimum="1.0.0.0"
IncludeMinimum="yes"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade>
<CustomAction Id="UIandAdvertised" Error="Something about the UI."/>
<Directory Id="TARGETDIR" Name="SourceDir"/>
<Feature Id="Complete"
Title="myApp"
Description="Installation of myApp $(var.ProductVersion)"
Level="1">
<ComponentRef Id="myAppFiles"/>
<ComponentRef Id="RegistryEntry"/>
</Feature>
<Property Id="WIXUI_INSTALLDIR">INSTALLDIR</Property>
<UIRef Id="WixUI_InstallDir"/>
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
<RemoveRegistryValues />
</InstallExecuteSequence>
</Product>
My files and reg infos are maintained in a separate file:
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="INSTALLDIR" Name="myapp">
<Component Id="myAppFiles" Guid="{xxxx-xxxx-xxxx-xxxx-xxxxxxxx}">
<File Id="myapp.dll" Name="myapp.dll" KeyPath="yes" Source="..\src\bin\x86\Release\myapp.dll" />
</Component>
<Component Id="RegistryEntry" Guid="{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxx}" Win64="no" >
<RegistryKey Root="HKCU" Key="Software\myapp" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Value="myapp" />
</RegistryKey>
</Component>
</Directory>
</Directory>
</DirectoryRef>
Any help will be highly appreciated.
Use Product ID ="*",
It changes product id guid for each build.
But keep upgrade code same for product, unless you dont want to support upgrade.
You can use major upgrade tag instead of Upgrade tag. It is easier to use.
<MajorUpgrade AllowDowngrades="no"
AllowSameVersionUpgrades="no"
Schedule="afterInstallValidate"
DowngradeErrorMessage="Newer version of [ProductName] is already installed."/>
I have wix bootstapper which includes 4 components: tree exe packages and one msi package. I want to do major update of msi package using bootstrapper below (only main code):
<Bundle Name="$(var.Name)" Version="$(var.Version)" Manufacturer="$(var.Manufacture)" UpgradeCode="$(var.UpgradCode)" Copyright="$(var.Copyright)">
....
<Chain>
<!-- TODO: Define the list of chained packages. -->
<PackageGroupRef Id="NetFx4Full"/>
<PackageGroupRef Id="PostgreSQL"/>
<PackageGroupRef Id="AdobeReader"/>
<PackageGroupRef Id="Application"/>
</Chain>
....
<PackageGroup Id="Application">
<MsiPackage Id="MyApplication"
SourceFile=".\MSI_File\application.msi"
DisplayInternalUI="yes"
Permanent="no"
Vital="yes"
Visible="no"/>
others packages...
</PackageGroup>
and msi code:
<Product Id="*"
Name="$(var.Name)"
Language="$(var.InstallerLanguage)"
Version="$(var.Version)"
UpgradeCode="$(var.UpgradeCode)"
Manufacturer="$(var.Manufacture)">
<Package Description="$(var.PackageDescritpion)"
InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine"
InstallPrivileges="elevated"
Platform="x64"/>
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>
<Directory Id="TARGETDIR" Name="SourceDir">
</Directory>
<Feature Id="Complete"
Level="1"
ConfigurableDirectory="INSTALLDIR">
<ComponentRef Id="Licence"/>
<ComponentRef Id="StartMenuFoldersComponent"/>
<ComponentRef Id="DatabaseConfigFolder"/>
<ComponentGroupRef Id="BinaryFileGroup"/>
<ComponentGroupRef Id="DatabaseConfigFileGroup"/>
<ComponentRef Id="ApplicationConfigFolder"/>
<ComponentRef Id="RemoveFolderOnUninstall"/>
</Feature>
<!-- Custom actions-->
.....
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate"/>
<!--Other custom actions-->
......
</InstallExecuteSequence>
To build my update msi and bootstrapp I set greater (the same for msi and bootstrapp) product version, for example old version has 1.0.0.0 and newer has 1.0.1.0. Upgrade code as a WIX documentation says remains unchanged. After run my update installer the new version of msi is not installig, in install directory still are old files. Does anyone know what I do wrong?
#Edit
Also I tried by adding MajorUpgrade element but after that bootstrapper doesn't start MSI:
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
<Directory Id="TARGETDIR" Name="SourceDir"/>
#Edit
Bootstrapper logs: http://wklej.to/Msczq
You need to add upgrade information to the .msi package. See http://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html for use of the MajorUpgrade element.
I am trying to create an MSI using WIX and I seem to have stumbled across a small issue that is confusing me a bit in regards to the upgrade. I have followed about 3 tutorials on the subject and each one gives me the same result. When I try to upgrade the application I get a generic
Another version of this product is already installed.
message. After looking around I saw that in order to successfully upgrade I need to specify a new Product GUID. This seemed odd to me because the main WiX website said that that is only needed for major installs. Since I wasn't getting much luck I decided to go with it. Lo and behold it successfully executed the installer, but when I checked in Add/Remove Programs I now had 2 copies of the application installed. This is driving me crazy. Please see the below .wxs and please show me my errors where applicable.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="PRODUCT-GUID-GOES-HERE-B86BCC79EEFD" Name="Sample Application" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Sample Inc." UpgradeCode="$(var.UpgradeCode)">
<Package Id="*" Keywords="Installer" Platform="x64" InstallerVersion="200" InstallPrivileges="elevated" InstallScope="perMachine" Compressed="yes" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="no" OnlyDetect="yes" Language="1033" Property="NEWPRODUCTFOUND" />
<UpgradeVersion Minimum="$(var.RTMProductVersion)" IncludeMinimum="no" Maximum="$(var.ProductVersion)" IncludeMaximum="no" Language="1033" Property="UPGRADEFOUND" />
</Upgrade>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="Sample" Name="Sample">
<Directory Id="INSTALLLOCATION" Name="Sample Application">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="SampleApplication" Guid="APPLICATION-GUID-GOES-HERE-c7247f5d1b42" Win64="yes">
<!-- TODO: Insert files, registry keys, and other resources here. -->
<File Id="SampleEXE" Name="Sample.exe" Source="Sample.exe" ProcessorArchitecture="x64" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="Complete" Title="sample64" Level="1">
<!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
<ComponentRef Id="SampleApplication" />
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
<ComponentGroupRef Id="Product.Generated" />
</Feature>
<CustomAction Id="NoDowngrade" Error="A later version of [ProductName] is already installed." />
<InstallExecuteSequence>
<Custom Action="NoDowngrade" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
<RemoveExistingProducts After="InstallFinalize" />
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action="NoDowngrade" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
</InstallUISequence>
</Product>
</Wix>
Thanks in advance for any help.
Set Product/#Id to "*" to get automatic product code changes and use the MajorUpgrade element. For more context, see my blog.
we're using Wix to create our installers. We're using the UI where one can select the features that need to be installed. Some features are enabled by default and others are disabled.
However, these defaults are retained when we run an upgrade. We would like the installer to remember what features were installed and enable them in the Feature Tree for upgrading. All other features should be disabled.
We had this code, which seemed to work, but actually, it didn't:
<Feature Id="MainFeature" Level="1" ConfigurableDirectory="INSTALLDIR" Display="expand">
<Feature Id="Feature1" Level="1" InstallDefault="local" AllowAdvertise="no">
<ComponentGroupRef Id="Feature1ComponentGroup" />
<Condition Level="3">(PROJECTUPGRADE AND NOT !Feature1=2)</Condition>
</Feature>
<Feature Id="Feature2" Level="3" InstallDefault="local" AllowAdvertise="no">
<ComponentGroupRef Id="Feature2ComponentGroup" />
<Condition Level="1">(PROJECTUPGRADE AND !Feature2=2)</Condition>
</Feature>
</Feature>
Ah, it seems I was looking in the wrong place. There is an attribute called 'MigrateFeatures' on the UpdgradeVersion tag that specifies this:
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="yes" OnlyDetect="yes" Property="PROJECTDOWNGRADE" />
<UpgradeVersion Maximum="$(var.ProductVersion)" IncludeMaximum="no" Property="PROJECTUPGRADE" MigrateFeatures="yes" />
</Upgrade>