Here's my code:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ProductName = "MyApp"?>
<?define ProductCode = "GUID_NO1"?>
<?define UpgradeCode = "GUID_NO2"?>
<?define ProductVersion = "1.0.0"?>
<Product Id="$(var.ProductCode)"
Name="$(var.ProductName)"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="Me"
UpgradeCode="$(var.UpgradeCode)">
<Package Description="My desc"
InstallerVersion="300"
Compressed="yes"
InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version is already installed." />
...
I build, install and all goes fine.
So I replace
<?define ProductCode = "GUID_NO3"?>
<?define UpgradeCode = "GUID_NO4"?>
<?define ProductVersion = "1.0.1"?>
I build, install and in programs/features i found 2 MyApp, one in version 1.0.0 and one in verison 1.0.1.
Of course I need the 1.0.0 to be removed.
Keeping the same guid for ProductCode will not work.
I'm using Wix 3.8.
Make sure that the UpgradeCode remains the same and change the Id to *.
<Product Id="*" Name="Stub" Language="1033" Version="$(var.Version)"
Manufacturer="" UpgradeCode="FAFD7276-68F3-43AF-BEBF-8F175499A243">
Related
I have the following code in my Product.wxs file
<Wix>
<?define ProductVersion="!(bind.fileVersion._957E198E_2074_A3FA_A554_6FE5D8E9F4FD)" ?>
<?define MajorVersion="!(bind.property.ProductVersion.Major)" ?>
<Product Id='*' Name='Software v$(var.MajorVersion)' Version='$(var.ProductVersion)' Manufacturer='...' UpgradeCode='...' Codepage='...'>
[...]
</Product>
</Wix>
The above is based on this Binding WIX FileVersion sub values? question's answer.
It gives me the following error though
My Plan B was smth like
<?define MajorVersion="!(bind.fileVersion._957E198E_2074_A3FA_A554_6FE5D8E9F4FD.Major)" ?>
or
<?define MajorVersion="!(bind.fileVersion.major._957E198E_2074_A3FA_A554_6FE5D8E9F4FD)" ?>
but those don't work either.
Ultimately I want to use the MajorVersion property/variable to be part of the install directory.
<CustomAction Id='DIRCA_TARGETDIR' Property='TARGETDIR' Value='[ProgramFilesFolder][Manufacturer]\[MajorVersion]\[ProductName]' Execute='firstSequence' />
Any help is greatly appreciated.
After some more digging I eventually found an answer myself.
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<?define MainAssemblyVersion="!(bind.fileVersion._957E198E_2074_A3FA_A554_6FE5D8E9F4FD)" ?>
<?define MajorVersion="!(bind.property.ProductVersion.Major)" ?>
<Product Id='*' Name='Software v$(var.MajorVersion' Language='1033' Version='$(var.MainAssemblyVersion)' Manufacturer='...' UpgradeCode='...' Codepage='...'>
[...]
<!-- Initialize the 'TARGETDIR' directory property. -->
<CustomAction Id='DIRCA_TARGETDIR' Property='TARGETDIR' Value='[ProgramFilesFolder][Manufacturer]\[ProductName] v$(var.MajorVersion)' Execute='firstSequence' />
[...]
</Product>
</Wix>
I believe I was partly confused by the fact that bind.property.ProductVersion already exists and doesn't have to be declared (which I did in my first example)
Once you have the major version part in a variable, using it $(var.MainAssemblyVersion) is really all it needs.
I find to set administration privilages for Wix installer you have to set:
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"/>
in <Product/>. But where/how set that for Bundle, because I cant create <Package/> ?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Name="Bootstrapper13" Version="1.0.0.0" Manufacturer="" UpgradeCode="86064926-b150-448f-aba9-fb0c8f4a83b5">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
</Chain>
</Bundle>
Burn automatically detects when you have a perMachine package; you don't have to tell it.
I have a product MSI with version 1.1.500.0.
On top of this I have created an MSP using WIX based on a contract predefined with Manufacturer Name and Version.
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Patch Id="*" AllowRemoval="yes" Manufacturer="My Publisher" MoreInfoURL="www.mysite.com" TargetProductName="My Product" DisplayName="My Product Display Name" Description="My Description" Classification="hotfix">
<Media Id="12200" Cabinet="RTM.cab">
<PatchBaseline Id="RTM" />
</Media>
<PatchFamily Id="fam1" Version="1.1.9058.27799" Supersede="no"></PatchFamily>
</Patch>
</Wix>
Opening this MSP with ORCA I can see the details correctly set.
However when I install the Patch the version and publisher are blank in the "View installed updates" list from Control Panel:
From the install log:
Executing op: ProductRegister(UpgradeCode={GUID},
VersionString=1.1.500.0,,,InstallLocation=C:\MyFolder\,
InstallSource=C:\Kit\,
Publisher=My Publisher,,,,NoModify=1,,,,Contact=My Publisher,,,,EstimatedSize=75216,,,,)
Can you maybe guide me on what can I check further?
Thanks!
I'am using WIX and losing my hair very quickly!
So I have my application installed on my pc - the version number is 1.1.1.0. I wish to install my new version (1.1.2.0) AND remove the previous version at the same time. I have gone through a few tutorials and have basically been trying trail and error to get this to work but cannot.
Below is my code I can't see what exactly I am missing though?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ProductName="Order Entry"?>
<?define ProductCode="4e447072-689e-4641-ad60-8ae18f1bfcf0"?>
<?define UpgradeCode="27cb76c7-544e-465f-b1f3-b11d9a49e416"?>
<?define RTMProductVersion=1.1.1.0?>
<?define ProductVersion=1.1.2.0?>
<Product Id="$(var.ProductCode)"
Version="$(var.ProductVersion)"
Name="$(var.ProductName)"
Language="1033"
Manufacturer="MyCompany"
UpgradeCode="4e447072-689e-4641-ad60-8ae18f1bfcf0">
<Package InstallerVersion="300" Compressed="yes" InstallScope="perMachine" />
<Media Id="1" Cabinet="myCab.cab" EmbedCab="yes" CompressionLevel="medium" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)"
IncludeMinimum="no"
OnlyDetect="yes"
Language="1033"
Property="NEWPRODUCTFOUND"/>
<UpgradeVersion Minimum="$(var.RTMProductVersion)"
IncludeMinimum="yes"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Language="1033"
Property="UPGRADEFOUND"/>
</Upgrade>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize"/>
<!-- <InstallExecute After="RemoveExistingProducts" />-->
</InstallExecuteSequence>
I'm using WiX to build an installation package for a product at my company and I want to be able to build two slightly different versions of the .msi depending on if it is meant to be used internally in the company for testing or externally for customers.
The internal version should be built with no UpgradeCode, so that we can have several versions installed at the same time for comparison. The external version should have a static UpgradeCode.
WiX does not allow me to have UpgradeCode auto generated by doing this:
<?if $(var.Configuration) = "Internal Release"?>
<?define UpgradeCode = "*"?>
<?else?>
<?define UpgradeCode = "[REALGUID]"?>
<?endif?>
<Product ... UpgradeCode="$(var.UpgradeCode)">
To have the UpgradeCode "auto generated" you have to completely ommit the UpgradeCode attribute.
Anyone have any suggestions on how to accomplish this?
Probably you can't use * for Upgrade Code (i'm not sure) but you could pass it as property through msbuild which i do for ProductCode conditionaly (if we are building patches or not)
<UpgradeCode Condition="$(InternalRelease)==1">{$([System.Guid]::NewGuid().ToString().ToUpper())}</UpgradeCode>
In your msbuild.proj add that property in your Target/msbuild project/Properties.
Add UpgradeCode=$(UpgradeCode) in you constants (wixproj)
Then in your main wxs add something like this:
<?if $(var.UpgradeCode)=""?>
<?define UpgradeCode=your-static-upgradecode ?>
<?endif?>
So if the project receives the upgrade code then it will use that one otherwise will be your fixed upgrade code in defined.
And finally to generated the guid call the msbuild.proj with /p:InteralRelease=1
Adding this answer as an alternative solution for other users with the same challenge.
Altough IlirB's answer probably would work as expected (I haven't tried it as I solved the problem with my own solution before the answer was provided), I solved the problem by conditionally including one of 2 different versions of the Product-tag. Of which only one had the UpgradeCode defined.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include Config.wxi?>
<?if $(var.IsExternalRelease) = yes?>
<Product Id="$(var.ProductID)" Name="$(var.ProductName)" Language="1033" Version="$(var.Version)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
<Package Id="$(var.PackageID)" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<PropertyRef Id="AllProperties"/>
<UIRef Id="CUSTOM_UI"/>
<FeatureRef Id="F_AllFeatures"/>
</Product>
<?else?>
<Product Id="$(var.ProductID)" Name="$(var.ProductName)" Language="1033" Version="$(var.Version)" Manufacturer="$(var.Manufacturer)">
<Package Id="$(var.PackageID)" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MediaTemplate EmbedCab="yes"/>
<PropertyRef Id="AllProperties"/>
<UIRef Id="CUSTOM_UI"/>
<FeatureRef Id="F_AllFeatures"/>
</Product>
<?endif?>
</Wix>
Because I made an effort in splitting the wix code into several pieces and referring them from the Product tag, there was not much duplication of code.