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.
Related
Here is my code just to copy a file however I don't see any directory created in program files or any notepad.exe file being copied? Where I am going wrong?
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="8806367C-FFA1-40C7-B16A-462CF6D941BE"
Name="Test_Product_Name" Version="0.0.1" Manufacturer="Test_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="20211022_test">
<Component Id="ApplicationFiles" Guid="172743A1-08E5-483C-96F1-0CE1373F2AF1">
<File Id="ApplicationFile1" Source="notepad.exe"/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles"/>
</Feature>
</Product>
</Wix>
Your source shows a 32bit MSI so Program Files (x86) is where it'll go.
TL:DR
How can I tell WiX to copy files from the installer to a specified directory within the user MyDocuments folder?
I'm trying to write a rudimentary installer using WiX.
I've figured out how to reference the projects and the executable, but I want the installer to write a few files to the MyDocuments directory of the user installing the program.
Why not AppData? Because most users don't know how to access the AppData directory and the program should allow the relatively easy access to the files in question, so that they can add or remove the files as they see fit, for good or for ill.
Additionally, if the user decides to remove those files, I would prefer for the program NOT to yell at them when on subsequent runs, as the program has internal checks to make sure the files exist before referencing them, and if they do not, references them internally.
What would I need to add to the following WiX script to tell it "Put MySetupInstallerDocument.txt in MyDocuments/MySetupProject/MySetupProjectFiles" where MySetupInstallerDocument.txt is located within the same folder as the .wxs file?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Id="*" Name="MySetupInstaller" Language="1033" Version="1.0.0.0" Manufacturer=""
UpgradeCode="07a36861-41cf-40e4-a1b6-eb970bc305ff">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade
DowngradeErrorMessage="Bla bla bla" />
<MediaTemplate />
<Feature Id="ProductFeature" Title="MySetupInstaller" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MySetupInstaller" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source="$(var.MySetupProject.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
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.
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'm getting very frustrated at the following warnings from light.exe that I'm getting when trying to use a merge module in my WiX installer project within VS2010:
ICE80: This 64BitComponent F_AdaptersInGac.5AE08CC6_EB8E_4F10_AB7B_CEFD0CB0F832
uses 32BitDirectory GAC.5AE08CC6_EB8E_4F10_AB7B_CEFD0CB0F832
(repeated for each file in the merge module).
Both the merge module and the product WiX files are part of the same VS2010 solution. Both merge module and product contain a <Package> element that specifies Platform="x64". The fragment in the merge module .wxs file looks like this:
<Package Id="{5AE08CC6-EB8E-4F10-AB7B-CEFD0CB0F832}" InstallerVersion="200" Languages="1033" Manufacturer="Yoyodyne Propulsion Systems" Platform="x64" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<!-- Assemblies that go in the GAC -->
<Directory Id="GAC" SourceName="GAC">
<Component Id="C_AdaptersInGac" Guid="{C1C7D6F8-197D-874E-79B9-EBFEBDDCB65A}" Win64="yes">
<File Id="F_AdaptersInGac" Name="ERPLink.Adapters.SharePoint.dll" KeyPath="yes" Assembly=".net" Source="..\Internal\Adapters\Release\Contoso.Adapters.dll" />
</Component>
</Directory>
</Directory>
</Directory>
Since I even put my component element inside of the ProgramFiles64Folder directory, and I've marked the platform as "x64", why am I getting this error? What other places control the 64-bitness of a directory in a WiX package file?
A merge module should have an abstraction such as MergeRedirectFolder so that when you consume them in the installer you associate MergeRedirectFolder with the actual [ProgramFiles]Company\Product target using the Directory and Merge elements.
Also if these files are meant to go into the GAC, there is a special folder identifier called GlobalAssemblyCache that can achieve this.
The following just worked for me:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ComponentRules="OneToOne"?>
<!-- SourceDir instructs IsWiX the location of the directory that contains files for this merge module -->
<?define SourceDir="..\Deploy"?>
<Module Id="StrongNameMM" Language="1033" Version="1.0.0.0">
<Package Id="0085d1f6-e7cf-413e-ae3c-cd1a1e0afb1b" Manufacturer="StrongNameMM" InstallerVersion="200" Platform="x64" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MergeRedirectFolder">
<Component Id="owc457F6083DF7B557CCA84E132209AC321" Guid="9ab7d95e-7841-3ff9-ffac-87a6b7633636" Win64="yes">
<File Id="owf457F6083DF7B557CCA84E132209AC321" Source="$(var.SourceDir)\ClassLibrary1.dll" KeyPath="yes" Assembly=".net"/>
</Component>
</Directory>
</Directory>
</Module>
</Wix>
Then in the main installer:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<FeatureGroup Id="features">
<Feature Id="StrongName" Title="StrongName" Description="Installs all the files needed for StrongName" Level="1" AllowAdvertise="no" ConfigurableDirectory="INSTALLLOCATION">
<MergeRef Id="StrongNameMM"/>
</Feature>
</FeatureGroup>
<!-- Content -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="CompanyFolder" Name="My Company">
<Directory Id="INSTALLLOCATION" Name="StrongName">
<Merge Id="StrongNameMM" SourceFile="$(var.StrongNameMM.TargetPath)" DiskId="1" Language="1033"/>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
</Wix>
Finally:
<Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" Platform="x64" />