Following is the wxs file for the main installer. This will be signed with Sign.pfx after it is created.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="48C49ACE-90CF-4161-9C6E-9162115A54DD"
Name="WiX Patch Example Product"
Language="1033"
Version="1.0.0"
Manufacturer="Dynamo Corporation"
UpgradeCode="48C49ACE-90CF-4161-9C6E-9162115A54DD">
<Package Description="Installs a file that will be patched."
Comments="This Product does not install any executables"
InstallerVersion="200"
Compressed="yes" AdminImage="no" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
<FeatureRef Id="SampleProductFeature"/>
<PatchCertificates>
<DigitalCertificate Id="MyNewCertificate" SourceFile="Sign.pfx"/>
</PatchCertificates>
<PackageCertificates>
<DigitalCertificate Id="MyNewCertificate" SourceFile="Sign.pfx"/>
</PackageCertificates>
</Product>
<Fragment>
<Feature Id="SampleProductFeature" Title="Sample Product Feature" Level="1">
<ComponentRef Id="SampleComponent" />
</Feature>
</Fragment>
<Fragment>
<DirectoryRef Id="SampleProductFolder">
<Component Id="SampleComponent" Guid="{C28843DA-EF08-41CC-BA75-D2B99D8A1983}" DiskId="1">
<File Id="SampleFile" Name="Sample.txt" Source=".\$(var.Version)\Sample.txt" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="SampleProductFolder" Name="Patch Sample Directory">
</Directory>
</Directory>
</Directory>
</Fragment>
</Wix>
Following is the patch file which needs to be installed without requiring admin rights.Currently the patch works fine but requires admin rights.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Patch
AllowRemoval="yes"
Manufacturer="Dynamo Corp"
MoreInfoURL="http://www.dynamocorp.com/"
DisplayName="Sample Patch"
Description="Small Update Patch"
Classification="Update"
>
<Media Id="5000" Cabinet="RTM.cab">
<PatchBaseline Id="RTM"/>
</Media>
<PatchFamilyRef Id="SamplePatchFamily"/>
</Patch>
<Fragment>
<PatchFamily Id='SamplePatchFamily' Version='1.2.0.0' Supersede='yes' ProductCode="48C49ACE-90CF-4161-9C6E-9162115A54DD">
<ComponentRef Id="SampleComponent"/>
</PatchFamily>
</Fragment>
</Wix>
The example code was taken from the official wix tutorial at http://wixtoolset.org/documentation/manual/v3/patching/wix_patching.html
How can I make it so that the application is installed for all users (with admin rights) (currently done) but non-admins can install the patch file.
What I've tried: added the PatchCertificates and PackageCertificates. Makes no difference.
Most of the examples I can find use a .cer file instead of a .pfx for a PatchCertificates/DigitalCertificate/#SourceFile (e.g. Question about UAC patching on Vista-patch certificate is not recognized which includes alternate directions for creating a .cer from a .pfx if you don't have one already, leveraging MsiGetFileSignatureInformation.) It's possible you need to specify a .cer file instead.
Related
I'm following a Wix tutorial that recommends creating a setup library project and writing this in Product.wxs:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="HelloWix" Language="1033" Version="1.0.0" Manufacturer="SoftAgility" UpgradeCode="2CA1BA0A-99C0-445C-8C72-083431F757DE">
<Package Description="Simple Demo" Compressed="yes" />
<MediaTemplate EmbedCab="yes"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="HelloWix" />
</Directory>
</Directory>
<Component Id="TextFileComponent" Directory="INSTALLFOLDER">
<File Source="C:\temp\MyFile.txt" />
</Component>
<Feature Id="MainFeature" Title="HelloWix" Level="1">
<ComponentRef Id="TextFileComponent" />
</Feature>
</Product>
</Wix>
This project is meant to setup a simple hello world type of setup in order to show the simplest piece of code needed to get a working installation package, with minimal requirements. Build is successful. Question is: where is the .msi generated?
Well, solution is I unloaded the wixproj and changed this line:
<OutputType>Library</OutputType>
to
<OutputType>Package</OutputType>
If you know of other methods, please add them. Thanks!
I have a component with an IniFile element in my WiX script. I need to set the read and write permissions for the Local Service to the resulting ini-file as the application runs under this account and must be able to read and write from/into the ini-file. The Permission(Ex) elements can't have IniFile as a parent so I don't see the native way in WiX to set permissions to an IniFile element, could anyone suggest a solution? The file is installed into a subfolder of CommonAppData.
The option to include a ready ini-file in the distribution and install it simply as a File is bad for me as the contents of the file depends on the individual installation (paths, computer name etc).
What version of Wix are you using? I am using Wix v3.9 and could get it to work. Well, I don't understand why the PermissionEx element would be concerned about the "Name" attribute of the File tab, especially when PermissionEx is itself nested/a child of the File tag.
Here is my sample project.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="INIFile" Language="1033" Version="1.0.0.0" Manufacturer="Test" UpgradeCode="4549f852-c012-4180-ab66-5d972f3faf53">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="INIFile" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="INIFile" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Id="TestFile" KeyPath="yes" Source="E:\Learning\Test Projects\Files\test.txt" Name="test.txt">
<PermissionEx Id="Blah" Sddl="O-AB-C" />
</File>
<IniFile Id="TestIni" Action="addLine" Directory="INSTALLFOLDER" Key="Test" Name="Test" Section="Test" Value="Test"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
I created a library in WiX with a single ComponentGroup, Component and File, this way:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<ComponentGroup Id="MyComponentGroup" Directory="WindowsFolder">
<Component Id="MyComponent" Guid="...">
<File Id="MyFile" Source="file.txt" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Then I created a WiX project, added a reference to this library (as a project reference) and I'm using this code:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="My Product" Language="1033"
Version="1.0.0.0" Manufacturer="Myself"
UpgradeCode="xxxxx">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Feature Id="Feature_Product" Title="Main Product"
Level="1" Absent="disallow" Description="Core functionality.">
<ComponentGroupRef Id="MyComponentGroup" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WindowsFolder" />
</Directory>
</Fragment>
</Wix>
But I'm receiving an error of Unresolved reference. Is there anything I'm missing? Or do libraries only work with UI and not files?
EDIT:
I added the complete code.
And it works if I use a FeatureRef and I move the Feature to the library, but I would like to keep the Feature in the main project and only have the Component in the library.
You haven't posted your entire error, but the error I get when using your example is:
Unresolved reference to symbol 'Media:1' in section 'Fragment:'
The unresolved reference is a missing media element; the File needs to be stored in a cabinet and it defaults to File/#DiskId="1" which is why it's looking for "Media:1". You need to tell WiX where to store the installation files. If you're using WiX 3.7, add this into your <Package> element:
<MediaTemplate EmbedCab="yes" />
If you're using an earlier version:
<Media Id="1" Cabinet="Cab1.cab" EmbedCab="yes" />
I have an executable package (.exe) of an application. How do convert this executable to an MSI package?
I am aware of converting a .msi into .wxs using the following.
dark.exe installer.msi
Here's a great little mini-tutorial. It's probably all you need:
http://www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with
1) Create Wix XML file
EXAMPLE:
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
</Wix>
2) Build an MSI for your .exe
EXAMPLE:
candle example.wxs
light example.wixobj
3) Voila. If there's nothing more complicated than "install the .exe", you're done!
Take the .msi to a difference PC and test.
The above link also discusses other scenarios, if you need them. For example:
ANOTHER, MORE REALISTIC .WIX FILE:
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="12345678-1234-1234-1234-111111111111"
Name="Example Product Name" Version="0.0.1" Manufacturer="Example Company Name" 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="Example">
<Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222">
<File Id="ApplicationFile1" Source="example.exe"/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles"/>
</Feature>
</Product>
</Wix>
Here is the "standard" tutorial, with much other information:
http://wix.tramontana.co.hu/
Bon soir (at least here in California ;))
'Hope that helps!
Use UniExtract to extract the MSIs from the EXE, then apply dark on the MSIs.
I'm trying to create a simple installer for a .net application in WiX. I installed Votive and am using the basic template wxs file it creates. When I compile it I get warning LGHT1076: ICE71: The Media table has no entries.
Also when I run the installer it starts and disappears during installation and there is no entry in the Add/Remove Programs app.
Here's the XML:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="26d654fe-af0f-4b48-8993-8e249597a130"
Name="Minefold"
Language="1033"
Version="0.0.0.1"
Manufacturer="Minefold"
UpgradeCode="6aad5a10-cbbe-472b-87fc-0813fb450836">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Minefold" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source="C:\code\Minefold\Minefold\bin\Debug\Minefold.exe" Id="Minefold.exe" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<Feature Id="Application" Title="Minefold" Level="1">
<ComponentRef Id="ProductComponent" />
</Feature>
</Fragment>
</Wix>
Add a Feature with a ComponentGroupRef to your Product. As written, nothing connects the Product with the content in the Fragments.