Wix Directory Problems - installation

I have two questions about the directories with using fragments in Windows Installer XML.
I got this fragment file from the heat.exe:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Directory Id="dir08A07F5561FBEB6B9772467C730F6445" Name="Test" />
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="InstallationFiles">
<Component Id="cmp071F7F8F6B6027C8D2841272FE526A2B" Directory="dir08A07F5561FBEB6B9772467C730F6445" Guid="{CCCB70AC-29F5-4DAA-B03E-1A2266649AB6}">
<File Id="fil63087E96FFB31F9E39B642CE8914F48B" KeyPath="yes" Source="SourceDir\dmedv.jpg" />
</Component>
<Component Id="cmpAE6CBEDA75641CF25BA9996AEB74A0DE" Directory="dir08A07F5561FBEB6B9772467C730F6445" Guid="{F5DABCAB-95D1-4197-A49F-E5F052A8E7EF}">
<File Id="filD27F2F6B26F5C14563865FE6C2AD5D50" KeyPath="yes" Source="SourceDir\Files.txt" />
</Component>
<Component Id="cmp25C5EADB5C0A9E779D20EC7B77BD42B0" Directory="dir08A07F5561FBEB6B9772467C730F6445" Guid="{E301B04A-6EA5-496B-A58A-8898110BE57C}">
<File Id="fil7C91C48D9AA0F2FE0EB37A21F108037F" KeyPath="yes" Source="SourceDir\readme.txt" />
</Component>
<Component Id="cmpD387AB4B40EDF14BF271ADDA7B71D2B7" Directory="dir08A07F5561FBEB6B9772467C730F6445" Guid="{6AF61DF4-32D0-4E7C-95B8-1DB9E7409029}">
<File Id="fil966691BA382AFC9343430FE162643432" KeyPath="yes" Source="SourceDir\readme1.txt" />
</Component>
<Component Id="cmpB86212407C1BEA12838C8C7B20495E9F" Directory="dir08A07F5561FBEB6B9772467C730F6445" Guid="{921E971E-E224-464C-9FBC-FBC5F78B3E5B}">
<File Id="fil61CD8EF43EA29DF58454E9A19F8C1EF9" KeyPath="yes" Source="SourceDir\readme2.txt" />
</Component>
<Component Id="cmpE4143B48FF854AE84F6054D4636FDE81" Directory="dir0ADF7E89B935DD39670130B4DC1D670E" Guid="{6F248718-93DD-4850-A18E-BD7079F738D5}">
<File Id="fil03847B355B6AADE5E4E04D143C92BC67" KeyPath="yes" Source="SourceDir\Test2\dmedv2.jpg" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<DirectoryRef Id="dir08A07F5561FBEB6B9772467C730F6445" />
</Fragment>
<Fragment>
<DirectoryRef Id="dir0ADF7E89B935DD39670130B4DC1D670E" />
</Fragment>
<Fragment>
<DirectoryRef Id="dir08A07F5561FBEB6B9772467C730F6445">
<Directory Id="dir0ADF7E89B935DD39670130B4DC1D670E" Name="Test2" />
</DirectoryRef>
</Fragment>
</Wix>
and I have this wix installer file:
<?xml version='1.0' encoding='windows-1252'?>
<?define ProductVersion="1.0.0.0"?>
<?define ProductName="DMServices Installer"?>
<?define Manufacturer="DM EDV- und Bürosysteme GmbH"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:iis='http://schemas.microsoft.com/wix/IIsExtension'>
<Product Name="$(var.ProductName)" Id='BB7FBBE4-0A25-4cc7-A39C-AC916B665220' UpgradeCode='8A5311DE-A125-418f-B0E1-5A30B9C667BD'
Language='1033' Codepage='1252' Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)">
<Package Id='*' Keywords='Installer'
Description="DMService Installer Setup"
Manufacturer='DM EDV- und Bürosysteme GmbH'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="the man" />
<PropertyRef Id="NETFRAMEWORK35"/>
<Condition Message='This setup requires the .NET Framework 3.5.'>
<![CDATA[Installed OR (NETFRAMEWORK35)]]>
</Condition>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder'>
<Directory Id='DM' Name='DM EDV'>
<Directory Id='INSTALLDIR' Name='DMServices'>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id='InstallationFiles' Title='InstallationFiles' Level='1'>
<ComponentGroupRef Id='InstallationFiles' />
</Feature>
</Product>
</Wix>
So far.
Now when i generate this files to wixobj, the compiler shows errors because the files can't be found. The files are in a directory called "Test". And in the file it's named SourceDir.
For a lil workaround i can copy the test directory and call it SourceDir ;-). So my Setup will be created.
How can I do it without a second directory?
EDIT: Problem is done.
Now i install my package. But whatever i do, the files will be installed to C:\Test.
But I want it to be installed in my Program Files Directory.
In many examples i can do it, like in the file, but i have to know the guids.
But we do wix for getting all files from one directory, without to put our hands on.
So how to install the files into the program files directory?

Take a closer look at -dr switch of heat.exe. You can put the necessary directory reference there. So, define your directory structure in the main file as you do now, and provide correct directory ID to heat.exe.
UPDATE:
Ok, the following works for me. The main directory structure:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLLOCATION" Name="My folder">
<Directory Id="WebsiteFolder" Name="Website">
...
</Directory>
</Directory>
</Directory>
The Feature references the ComponentGroup:
<Feature Id="ProductFeature" Title="!(loc.ProductFeature.Title)" Level="100">
...
<ComponentGroupRef Id="WebsiteFolderComponentGroup"/>
...
</Feature>
The heat.exe generates the following fragment:
<Fragment>
<DirectoryRef Id="WebsiteFolder">
<Component Id="cmp1" Guid="GUID-GOES-HERE">
<File Id="fil1" KeyPath="yes" Source="$(var.WebsiteFolderSource)\Default.aspx" />
</Component>
<Component Id="cmp2" Guid="GUID-GOES-HERE">
<File Id="fil2" KeyPath="yes" Source="$(var.WebsiteFolderSource)\default.css" />
</Component>
<Directory Id="dir1" Name="App_Browsers">
<Component Id="cmp3" Guid="GUID-GOES-HERE">
<File Id="fil3" KeyPath="yes" Source="$(var.WebsiteFolderSource)\App_Browsers\Form.browser" />
</Component>
</Directory>
<Directory Id="App_Config" Name="App_Config">
<Component Id="cmp4" Guid="GUID-GOES-HERE">
<File Id="fil4" KeyPath="yes" Source="$(var.WebsiteFolderSource)\App_Config\ConnectionStrings.config" />
</Component>
</Directory>
<Directory Id="bin" Name="bin">
<Component Id="cmp5" Guid="GUID-GOES-HERE">
<File Id="fil5" KeyPath="yes" Source="$(var.WebsiteFolderSource)\bin\MySystem.Web.UI.dll" />
</Component>
<Component Id="cmp6" Guid="GUID-GOES-HERE">
<File Id="fil6" KeyPath="yes" Source="$(var.WebsiteFolderSource)\bin\Another.dll" />
</Component>
...
</Directory>
...
</Directory>
...
<ComponentGroup Id="WebsiteFolderComponentGroup">
<ComponentRef Id="cmp1" />
<ComponentRef Id="cmp2" />
<ComponentRef Id="cmp3" />
<ComponentRef Id="cmp4" />
...
</ComponentGroup>
And finally, the heat command which generates necessary output looks like this (Nant sample):
<exec program="heat.exe" verbose="true" basedir="${paths.source}">
<arg line='dir "${paths.dist.website}"'/><!-- Notice the quotes inside the attributes -->
<arg line='-srd'/>
<arg line='-dr WebsiteFolder'/>
<arg line='-cg WebsiteFolderComponentGroup'/>
<arg line='-out "${paths.harvest}\website.wxs"'/>
<arg line='-ke -sfrag -scom -sreg -gg'/>
<arg line='-var var.WebsiteFolderSource'/>
</exec>
These snippets contain enough information to understand how it all works. Play with heat.exe switches to find out the combination you need. Good luck!

In case people like me still looking for clarification: The <DirectoryRef Id="WebsiteFolder"> in the heat fragment is important, it is the reference to where the fragment files should be installed. If you have multiple fragments and want to place it in different locations, the DirectoryRef is the key.

Related

What is the proper way to add multiple class library projects in wix installer

I am trying to create a wix installer for window service. My service consists four class library projects. My questions is how can i add multiple class library projects in wix installer. I followed this link https://github.com/Robs79/How-to-create-a-Windows-Service-MSI-Installer-Using-WiX/blob/master/WindowsService.Installer/Product.wxs its not shows how to add multiple class library projects. Please some one help me out how can do this. or provide some reference link where i can refer.
Thanks in Advance
Product.wxs:
<?define Manufacturer = "IRIZ ID TECH" ?>
<?define VersionNumber = "1.0.0.0" ?>
<?define UpgradeCode = "{FF9D7B21-A4FE-4DEB-A2FE-E77228F95831}" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
UpgradeCode="$(var.UpgradeCode)"
Version="$(var.VersionNumber)"
Language="1033"
Name="$(var.Name)"
Manufacturer="$(var.Manufacturer)">
<Package InstallerVersion="300" Compressed="yes" InstallScope="perMachine" />
<Media Id="1" Cabinet="ESS_VillageMateIntegrtion" EmbedCab="yes"></Media>
<!-- Allow upgrades and prevent downgrades -->
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="WindowsService.Installer" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<!-- Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="$(var.Name)" />
</Directory>
</Directory>
</Directory>
</Fragment>
<!-- Add files to your installer package -->
<Fragment>
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="$(var.ESS_VillageMateIntegrtion.TargetFileName)" Guid="{F03996CC-3A49-47A7-91F1-27DBF563AE83}">
<File Id="$(var.ESS_VillageMateIntegrtion.TargetFileName)" Source="$(var.ESS_VillageMateIntegrtion.TargetPath)" KeyPath="yes" />
</Component>
<Component Id="$(var.ESS_VillageMateIntegrtionServiceConfig.TargetFileName)" Guid="{CC064C9B-298A-4D6D-AF64-40DA3657AAAB}">
<File Id="$(var.ESS_VillageMateIntegrtionServiceConfig.TargetFileName)" Source="$(var.ESS_VillageMateIntegrtionServiceConfig.TargetPath)" KeyPath="yes" />
</Component>
<Component Id="$(var.ESS_VillageMateService.TargetFileName)" Guid="{CB37D43D-BB08-4DF2-A7B0-87A819A66CED}">
<File Id="$(var.ESS_VillageMateService.TargetFileName)" Source="$(var.ESS_VillageMateService.TargetPath)" KeyPath="yes" />
</Component>
<Component Id="$(var.ESS_VillageMateIntegrationTray.TargetFileName)" Guid="{71FD65C9-A657-4093-8D5A-28743972E536}">
<File Id="$(var.ESS_VillageMateIntegrationTray.TargetFileName)" Source="$(var.ESS_VillageMateIntegrationTray.TargetPath)" KeyPath="yes" />
</Component>
<Component Id="Components">
<!-- Remove the log file on uninstall -->
<RemoveFile Id="log" Name="*.txt" On="both" />
<!-- Tell WiX to install the Service -->
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="ESS_VillageMateIntegrtion"
DisplayName="ESS_VillageMateIntegrtion Service"
Description="Write Data one DB to another DB"
Start="auto"
Account="LocalSystem"
ErrorControl="normal" />
<!-- Tell WiX to start the Service -->
<ServiceControl Id="StartService"
Start="install"
Stop="both"
Remove="uninstall"
Name="ESS_VillageMateIntegrtion"
Wait="yes" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>

custom event not executing while first time setup using wix installer

I am trying to develop an application using SingnalR which will install into client machine and continuously give me update on a particular port. I made client setup using WIX and added a custom event to register port to the client machine. Now the issue is, while I am going to run the setup for the first time on client's machine, my custom event is not getting fired. But if I run the installer for second time, it is getting fired. I don't know what is the issue.
.wxs file is as below,
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define WixSetup2_TargetDir=$(var.WixSetup2.TargetDir)?>
<Product Id="*" Name="TestCompany" Language="1033" Version="1.0.0.0" Manufacturer="Test" UpgradeCode="aacb5b21-2f9c-4d93-b47c-d6ec8868dc65">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" AdminImage="yes" />
<MajorUpgrade DowngradeErrorMessage="A newer version of Test is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SetupProject1" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="ProgramFilesFolder_files" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupProject1" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="WixSetup2.exe" Guid="ca9e28f3-b059-48db-ae8c-3ea39c471644">
<File Id="WixSetup2.exe" Name="WixSetup2.exe" Source="$(var.WixSetup2_TargetDir)WixSetup2.exe" />
</Component>
<Component Id="WixSetup2.exe.config" Guid="3ac3746a-c59e-450d-a575-4c137c959309">
<File Id="WixSetup2.exe.config" Name="WixSetup2.exe.config" Source="$(var.WixSetup2_TargetDir)WixSetup2.exe.config" />
</Component>
<Component Id="Owin.dll" Guid="7610272c-0faa-40b9-b633-1f251d05c360">
<File Id="Owin.dll" Name="Owin.dll" Source="$(var.WixSetup2_TargetDir)Owin.dll" />
</Component>
<Component Id="Microsoft.AspNet.SignalR.Core.dll" Guid="0bb82458-a72a-49e5-adbe-36d3521f8322">
<File Id="Microsoft.AspNet.SignalR.Core.dll" Name="Microsoft.AspNet.SignalR.Core.dll" Source="$(var.WixSetup2_TargetDir)Microsoft.AspNet.SignalR.Core.dll" />
</Component>
<Component Id="Microsoft.AspNet.SignalR.SystemWeb.dll" Guid="8f06a4f7-93fe-45f3-a82a-ed5d5f102d17">
<File Id="Microsoft.AspNet.SignalR.SystemWeb.dll" Name="Microsoft.AspNet.SignalR.SystemWeb.dll" Source="$(var.WixSetup2_TargetDir)Microsoft.AspNet.SignalR.SystemWeb.dll" />
</Component>
<Component Id="Microsoft.Owin.dll" Guid="98e2aa07-583d-4fe5-bf0b-04c7dd544899">
<File Id="Microsoft.Owin.dll" Name="Microsoft.Owin.dll" Source="$(var.WixSetup2_TargetDir)Microsoft.Owin.dll" />
</Component>
<Component Id="Microsoft.Owin.Hosting.dll" Guid="8e662dd5-27ee-46fc-aa66-513e2a2620ef">
<File Id="Microsoft.Owin.Hosting.dll" Name="Microsoft.Owin.Hosting.dll" Source="$(var.WixSetup2_TargetDir)Microsoft.Owin.Hosting.dll" />
</Component>
<Component Id="Microsoft.Owin.Cors.dll" Guid="ec90a805-82c9-4293-8ef7-83b8b2675e2d">
<File Id="Microsoft.Owin.Cors.dll" Name="Microsoft.Owin.Cors.dll" Source="$(var.WixSetup2_TargetDir)Microsoft.Owin.Cors.dll" />
</Component>
<Component Id="System.Web.Cors.dll" Guid="7aa9db0e-51af-4b46-bb5d-abebc7e66285">
<File Id="System.Web.Cors.dll" Name="System.Web.Cors.dll" Source="$(var.WixSetup2_TargetDir)System.Web.Cors.dll" />
</Component>
<Component Id="Newtonsoft.Json.dll" Guid="ade7f021-743d-4d36-8fcd-c1a991f4b133">
<File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" Source="$(var.WixSetup2_TargetDir)Newtonsoft.Json.dll" />
</Component>
<Component Id="Microsoft.Owin.Host.SystemWeb.dll" Guid="38f6eaab-041a-401c-8fdb-2f841fbcea6a">
<File Id="Microsoft.Owin.Host.SystemWeb.dll" Name="Microsoft.Owin.Host.SystemWeb.dll" Source="$(var.WixSetup2_TargetDir)Microsoft.Owin.Host.SystemWeb.dll" />
</Component>
<Component Id="Microsoft.Owin.Security.dll" Guid="82ef20d9-562b-4bf4-85a0-4ea446bc5095">
<File Id="Microsoft.Owin.Security.dll" Name="Microsoft.Owin.Security.dll" Source="$(var.WixSetup2_TargetDir)Microsoft.Owin.Security.dll" />
</Component>
<Component Id="Microsoft.Owin.Host.HttpListener.dll" Guid="a00da1a6-563b-4318-8bcc-eb21c5c7d7bd">
<File Id="Microsoft.Owin.Host.HttpListener.dll" Name="Microsoft.Owin.Host.HttpListener.dll" Source="$(var.WixSetup2_TargetDir)Microsoft.Owin.Host.HttpListener.dll" />
</Component>
<Component Id="Microsoft.Owin.Diagnostics.dll" Guid="c5e44f7a-6961-4e9c-b2af-5d4a7e8d8b9d">
<File Id="Microsoft.Owin.Diagnostics.dll" Name="Microsoft.Owin.Diagnostics.dll" Source="$(var.WixSetup2_TargetDir)Microsoft.Owin.Diagnostics.dll" />
</Component>
</ComponentGroup>
<CustomAction Id="addPort" Directory="INSTALLFOLDER" Execute="immediate" Impersonate="no" ExeCommand="[SystemFolder]netsh.exe http add urlacl http://*:1919/ user=Everyone" Return="check">
</CustomAction>
<InstallExecuteSequence>
<Custom Action="addPort" Before="InstallExecute">Installed</Custom>
</InstallExecuteSequence>
</Fragment>
<Fragment>
<ComponentGroup Id="ProgramFilesFolder_files" Directory="INSTALLFOLDER">
<Component Id="Scripts_jquery_3.1.1.intellisense.js" Guid="e47264ab-facd-4c3b-9372-69e2f972fb44">
<File Id="Scripts_jquery_3.1.1.intellisense.js" Name="jquery-3.1.1.intellisense.js" Source="$(var.WixSetup2_TargetDir)Scripts\jquery-3.1.1.intellisense.js" />
</Component>
<Component Id="Scripts_jquery_3.1.1.js" Guid="b51ca2fd-3c8a-461e-8340-e26b90dbeb4c">
<File Id="Scripts_jquery_3.1.1.js" Name="jquery-3.1.1.js" Source="$(var.WixSetup2_TargetDir)Scripts\jquery-3.1.1.js" />
</Component>
<Component Id="Scripts_jquery_3.1.1.min.js" Guid="df63a174-bf0e-40ca-b634-aac1a9777afa">
<File Id="Scripts_jquery_3.1.1.min.js" Name="jquery-3.1.1.min.js" Source="$(var.WixSetup2_TargetDir)Scripts\jquery-3.1.1.min.js" />
</Component>
<Component Id="Scripts_jquery_3.1.1.slim.js" Guid="63ddd1f4-b695-4441-8ce2-f81473069868">
<File Id="Scripts_jquery_3.1.1.slim.js" Name="jquery-3.1.1.slim.js" Source="$(var.WixSetup2_TargetDir)Scripts\jquery-3.1.1.slim.js" />
</Component>
<Component Id="Scripts_jquery_3.1.1.slim.min.js" Guid="15b3bc22-b845-4d65-9c4b-baf654959531">
<File Id="Scripts_jquery_3.1.1.slim.min.js" Name="jquery-3.1.1.slim.min.js" Source="$(var.WixSetup2_TargetDir)Scripts\jquery-3.1.1.slim.min.js" />
</Component>
<Component Id="Scripts_jquery.signalR_2.2.1.js" Guid="915b874f-398a-4e9e-af24-e68045ffca71">
<File Id="Scripts_jquery.signalR_2.2.1.js" Name="jquery.signalR-2.2.1.js" Source="$(var.WixSetup2_TargetDir)Scripts\jquery.signalR-2.2.1.js" />
</Component>
<Component Id="Scripts_jquery.signalR_2.2.1.min.js" Guid="085dd028-262d-47b1-9b48-fc19d8e3db87">
<File Id="Scripts_jquery.signalR_2.2.1.min.js" Name="jquery.signalR-2.2.1.min.js" Source="$(var.WixSetup2_TargetDir)Scripts\jquery.signalR-2.2.1.min.js" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
It would be great if you can help me to get rid of this issue.
You have set the condition to run only if the product already installed.
Change the condition in the custom action to Not installed.
<Custom Action="addPort" Before="InstallExecute">NOT Installed</Custom>

Wix Toolset - Conditional installation based on TargetDir

I have to install an application with several folders. If my Targetdir is not a default path, say [ProgramFilesFolder]\[Manufacturer]\[ProductName], all the folders can be installed in that Targetdir. Otherwise, some folders, say "Bin" and "AddIns", should be installed in a different path, say [CommonAppDataFolder]\[Manufacturer]\[ProductName].
I would like to avoid a C# or C++ custom action. Instead, I would try to use something like a Type51 CA. Is it possible?
I wrote the following code:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="CommonAppDataFolder">
<Directory Id="dir_B1AA3D43_E9A6_4283_81B7_D24FDA02FEC4" Name="List SpA">
<Component Id="comp_dir_B1AA3D43_E9A6_4283_81B7_D24FDA02FEC4" Guid="AB641867-3F7A-4A74-9923-03E71FC6851C" KeyPath="yes" Transitive="yes">
<Condition><![CDATA[TARGETDIR = "[ProgramFilesFolder][Manufacturer]\[ProductName]"]]></Condition>
</Component>
<Directory Id="dir_9D19AF5A_89F2_498D_AC25_B48F2C16BFF5" Name="TestApplication">
<Directory Id="dir_BinID2" Name="Bin">
<Component Id="comp_dir_BinID2" Guid="2E369F78-D321-4828-A2A8-E958E57B910B" KeyPath="yes">
<Condition><![CDATA[TARGETDIR = "[ProgramFilesFolder][Manufacturer]\[ProductName]"]]></Condition>
</Component>
<Component Id="comp_38B4C656_8291_4C45_98D5_A46908E33723" Guid="61DB01E5-6D6B-48AE-862A-3E2C18D546E7" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_14E547A6_A0C5_441E_A294_59AD578B99DF" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="TestApplication.exe" Source="..\Debug\TestApplication.exe" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="dir_AddInsID2" Name="AddIns">
<Component Id="comp_dir_AddInsID2" Guid="0CA9B394-77E5-48A9-85A8-F6FF0737C499" KeyPath="yes" Transitive="yes">
<Condition><![CDATA[TARGETDIR = "[ProgramFilesFolder][Manufacturer]\[ProductName]"]]></Condition>
</Component>
<Component Id="comp_6DCECE0A_AE42_49F1_BA42_B23EF2A50E44" Guid="216B87DA-4F28-4DC9-85AA-E3801E2C0A8B" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_D271147D_4984_4C55_9660_33F4617957F5" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ClosePromptCA.CA.dll" Source="..\ClosePromptCA\bin\Debug\ClosePromptCA.CA.dll" KeyPath="yes" />
</Component>
<Component Id="comp_98FCDB58_9307_44D7_9CFE_3F1DB41BD779" Guid="B8368238-B1B6-4D78-BC21-0D26B84E4938" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_75368244_3285_47FD_BBC8_60CEC98755B4" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="Microsoft.Deployment.WindowsInstaller.dll" Source="..\ClosePromptCA\bin\Debug\Microsoft.Deployment.WindowsInstaller.dll" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Directory Id="dir_AddInsID" Name="AddIns">
<Component Id="comp_dir_AddInsID" Guid="0219CA84-4787-4737-99E7-95ACD8E0846D" KeyPath="yes" Transitive="yes">
<Condition><![CDATA[TARGETDIR <> "[ProgramFilesFolder][Manufacturer]\[ProductName]"]]></Condition>
</Component>
<Component Id="comp_23612F37_B27B_49E2_9FB6_9D2FA3654FB1" Guid="290915D5-38E9-4540-B7B7-7BBC27D96CA0" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_0193CC70_4486_4226_BE10_4F9C927DD5F2" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ClosePromptCA.CA.dll" Source="..\ClosePromptCA\bin\Debug\ClosePromptCA.CA.dll" KeyPath="yes" />
</Component>
<Component Id="comp_41AA7508_C12C_46CC_A383_7088A8500898" Guid="5CACA050-A59C-44DF-BF5A-8694D547D937" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_362C000D_A631_4E5D_9288_FB623CD999E3" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ClosePromptCA.XML" Source="..\ClosePromptCA\bin\Debug\ClosePromptCA.XML" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="dir_BinID" Name="Bin">
<Component Id="comp_dir_BinID" Guid="99ADE113-162C-4299-8A3E-EDCE1FB838DE" KeyPath="yes" Transitive="yes">
<Condition><![CDATA[TARGETDIR <> "[ProgramFilesFolder][Manufacturer]\[ProductName]"]]></Condition>
</Component>
<Component Id="comp_FD9AB046_9110_4BFD_865F_D919F02D7B2B" Guid="5690A672-809F-47D1-938E-EAC0E18A0685" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_89CFA2F5_2ED8_43C8_890E_A791BF9E16BB" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="TestApplication.exe" Source="..\Debug\TestApplication.exe" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="dir_DocsID" Name="Docs">
<Component Id="comp_ECF1F68E_B9B8_49DD_9631_88E0722F8FCC" Guid="CB3861D1-6101-4F3C-94DD-AEE3EE74C217" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_9CE2FA29_27F8_4C00_B22D_A99AA59E5B2D" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ReadMe.txt" Source="..\TestApplication\ReadMe.txt" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="dir_LogsID" Name="Logs">
<Component Id="comp_B81BDCFD_B947_49C0_A07F_C1546D02E7AF" Guid="CE5206CE-E651-42C6-88AF-B7D83A9318C2" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_FF44C1E7_C235_47B9_BA01_C797D13EBA7D" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="trace.log" Source="bin\Debug\trace.log" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="dir_TemplateID" Name="Template">
<Component Id="comp_8F946A00_3D1E_44C5_A288_E0662FFE253D" Guid="8C0A501B-15D4-46B1-91C3-23E5035CB145" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_39F2BD37_C7FE_4CF1_98C7_1E7BFC1B4873" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ReadMe.txt" Source="..\..\CrashReportManager\ReadMe.txt" KeyPath="yes" />
</Component>
</Directory>
</Directory>
Everything looks like right, but Wix ignore the Conditions. Wix installs my components even if the conditions are false!
What is the reason?
You can automatically harvest the both locations and set each location to different directory path.
Heat - http://wixtoolset.org/documentation/manual/v3/msbuild/task_reference/heatdirectory.html
Directory flag is the harvesting directory.
DirectoryRefId is where to deploy on target machine.
This is the most common way to do that.
You can address the special folder by using its special folders ID, a list of possible IDs can be found at msdn "System Folder Properties".
The following code sample will show you how the directory structure for your case could look like:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="MyProgramFilesFolder" Name="Manufacturer">
<Directory Id="INSTALLLOCATION" Name="InstallLocation">
<!-- Your "all the folders can be installed in that Targetdir"
can be inserted here -->
</Directory>
</Directory>
</Directory>
<Directory Id="CommonAppDataFolder">
<Directory Id="ProgramFileFolder" Name="Manufacturer">
<!--Your " 'Bin' and 'AddIns' Folders"-->
<Directory Id="AddinFolder" Name="AddIns">
<Component Id="YourFile" Guid="{SOME GUID}">
<!-- Just a file below your folder -->
<File Id="YourFile"
Name="FileName"
Source="Source of the file"/>
</Component>
</Directory>
</Directory>
</Directory>
The Code above could be used without a condition.
If you really like to install them to different folders based on Conditions, You need to duplicate your Components.
Here is a sample Condition below one of the Components:
<Component Id="YourFile" Guid="{SOME GUID}">
<Condition>YourCondition</Condition>
<!-- Just a file below your folder -->
<File Id="YourFile"
Name="FileName"
Source="Source of the file"/>
</Component>

How to Reference a Heat Output(wxs) in Wix (Command Line)

I am using heat.exe to generate a .wxs file to include files in my main installer. I have two questions:
Which switches would I use to register a DLL?
Once I have generated the output file how do I go about adding it to my "Main.wxs" file? (Please be pretty explicit, new to this)
I have looked around a lot for an answer to the second question and I always come up with something vague or for VS, I am working from the command line. Thanks!
This is what I have tried thus far: I get the error: (LGHT0103: The system cannot find the file "file") I get this error for all of my files.
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="cmp1D2A500FA963CF9DB333FD18154B94BC" Guid="{8DE755D7-F1F9-4EC3-BCD5-B72360B8752A}">
<File Id="filCBD973AD942425DC5F533B29866FEF5A" KeyPath="yes" Source="SourceDir\DLLs\FP7000-Camera.dll" />
</Component>
<Component Id="cmp4CC93670B061A60B94C1867DCFAAAED0" Guid="{717E0819-2842-4C0D-BFAB-30E4C8C66F7E}">
<File Id="fil7CEC0F75EDE8EEF9C7F6D563E8D04EF9" KeyPath="yes" Source="SourceDir\DLLs\libmfxsw64.dll" />
</Component>
<Component Id="cmpE80ACF08DF44E67E7583F35557C8EB02" Guid="{4CAA0627-45DB-4E34-9B4C-C54B5E21346C}">
<File Id="fil1E619A89A3D0D2FDE446E60B3D3EB2AF" KeyPath="yes" Source="SourceDir\DLLs\pthreadVC2.dll" />
</Component>
</ComponentGroup>
</Fragment>
You can cut the component nodes and paste them into the correct installation directory in your main wxs file. As an example you can check out this simple mock-up:
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="put-guid-here"
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="FP7000-Camera.dll" Guid="*">
<File Id="FP7000-Camera.dll" Source="replace with path to FP7000-Camera.dll"/>
</Component>
further components can be added here.
</Directory>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="FP7000-Camera.dll"/>
</Feature>
</Product>
</Wix>
You should extract the COM data for your COM files. Here is a sample Heat.exe command. (Note: if your dll fails to load due to missing dependencies you might need to install your sdk setup before running the extraction):
heat file MyComFile.ocx -out MyComFile.wxs
the resulting, extracted COM data in MyComFile.wxs will look something like this:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Directory Id="dirE645D1B018BB48C41BDBE188A129817F" Name="wix310-binaries" />
</DirectoryRef>
</Fragment>
<Fragment>
<DirectoryRef Id="dirE645D1B018BB48C41BDBE188A129817F">
cut from here
<Component Id="cmpD8BB195A00599F06D2FF16982DBAA523" Guid="PUT-GUID-HERE">
<File Id="filBDC3CFD8FF09857ADE9793AF172F66E6" KeyPath="yes" Source="SourceDir\wix310-binaries\ITDetector.ocx">
<TypeLib Id="{D6995525-B33A-4980-A106-9DF58570CC66}" Description="ITDetector 1.0 Type Library" HelpDirectory="dirE645D1B018BB48C41BDBE188A129817F" Language="0" MajorVersion="1" MinorVersion="0">
<Class Id="{D719897A-B07A-4C0C-AEA9-9B663A28DFCB}" Context="InprocServer32" Description="iTunesDetector Class" ThreadingModel="apartment" Programmable="yes" SafeForScripting="yes" SafeForInitializing="yes">
<ProgId Id="ITDetector.iTunesDetector.1" Description="iTunesDetector Class">
<ProgId Id="ITDetector.iTunesDetector" Description="iTunesDetector Class" />
</ProgId>
</Class>
<Interface Id="{45D2C838-0137-4E6A-AA3B-D39B4A1A1A28}" Name="IiTunesDetector" ProxyStubClassId32="{00020424-0000-0000-C000-000000000046}" />
</TypeLib>
</File>
</Component>
to here
</DirectoryRef>
</Fragment>
</Wix>
Paste the component into your main wxs file in the appropriate Directory location. For example in INSTALLDIR as illustrated in the first WXS file above.
Finally a merged sample showing the main wxs file populated with the extracted component nodes from your heat.exe tool:
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="put-guid-here"
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="FP7000-Camera.dll" Guid="*">
<File Id="FP7000-Camera.dll" Source="replace with path to FP7000-Camera.dll"/>
</Component>
<Component Id="cmpD8BB195A00599F06D2FF16982DBAA523" Guid="*">
<File Id="filBDC3CFD8FF09857ADE9793AF172F66E6" KeyPath="yes" Source="SourceDir\wix310-binaries\ITDetector.ocx">
<TypeLib Id="{D6995525-B33A-4980-A106-9DF58570CC66}" Description="ITDetector 1.0 Type Library" HelpDirectory="dirE645D1B018BB48C41BDBE188A129817F" Language="0" MajorVersion="1" MinorVersion="0">
<Class Id="{D719897A-B07A-4C0C-AEA9-9B663A28DFCB}" Context="InprocServer32" Description="iTunesDetector Class" ThreadingModel="apartment" Programmable="yes" SafeForScripting="yes" SafeForInitializing="yes">
<ProgId Id="ITDetector.iTunesDetector.1" Description="iTunesDetector Class">
<ProgId Id="ITDetector.iTunesDetector" Description="iTunesDetector Class" />
</ProgId>
</Class>
<Interface Id="{45D2C838-0137-4E6A-AA3B-D39B4A1A1A28}" Name="IiTunesDetector" ProxyStubClassId32="{00020424-0000-0000-C000-000000000046}" />
</TypeLib>
</File>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="FP7000-Camera.dll"/>
<ComponentRef Id="cmpD8BB195A00599F06D2FF16982DBAA523"/>
</Feature>
</Product>
</Wix>
If the above is unclear, please try to read this answer: How to run heat.exe and register a dll in wix

WiX not embedding binaries

I'm using WiX to create my products installer. For some reason it's no longer embedding the .exes and .dlls inside the installer. So I have this:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="USERSPECIFIEDDIR" Name="My-app-name" />
</Directory>
and it creates a .msi alongside a folder called My-app-name that contains all .exe and dll files required for the application. if i run the installer from there, it's alright, but if i move the msi elsewhere (without the subdirectory), it errors out because it can't find the files. how can i tell WiX to embed all binaries inside the installer??
in case it helps, here are some other snippets from my wxs. let me know if you need any other information. oh, and i'm using wix directly from visual studio 2008.
<DirectoryRef Id="USERSPECIFIEDDIR">
<Component Id="MainExe" Guid="580F8F15-C06C-49A7-ADDC-56C96580DC0D">
<File Id="MainExe" Name="OrderMonkey.exe" KeyPath="yes" />
</Component>
<Component Id="OMEmailerExe" Guid="3B0AECC3-67E5-40B3-83CB-9B84FE965ED8">
<File Id="OMEmailerExe" Name="OMEmailer.exe" />
</Component>
<Component Id="migradomDLL" Guid="37E1BCAE-EB39-4DF5-88C7-AE74CA5EA171">
<File Id="migradom" Name="MigraDoc.DocumentObjectModel.dll" />
</Component>
<Component Id="migrarenderDLL" Guid="C2910B9E-0B06-467A-853C-7651BE7BD9E4">
<File Id="migrarender" Name="MigraDoc.Rendering.dll" />
</Component>
<Component Id="migrartfDLL" Guid="CEBE4DE9-7CA0-4F48-A8B1-1D46E4E48B66">
<File Id="migrartf" Name="MigraDoc.RtfRendering.dll" />
</Component>
<Component Id="mysqldataDLL" Guid="2E474737-474C-4146-8E67-D3837B5DB862">
<File Id="mysqldata" Name="MySql.Data.dll" />
</Component>
<Component Id="pdfchartingDLL" Guid="7467B6C2-BE38-4283-B179-9FA94C4A087F">
<File Id="pdfcharting" Name="PdfSharp.Charting.dll" />
</Component>
<Component Id="pdfsharpDLL" Guid="39F23E36-BF9C-40C1-8190-6A3554B879BC">
<File Id="pdfsharp" Name="PdfSharp.dll" />
</Component>
<Component Id="sqliteDLL" Guid="B043CF20-8DC2-4A10-AE4B-4721263A111E">
<File Id="sqlite" Name="System.Data.SQLite.dll" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="414E91FD-7410-492C-9D48-8125C6ECCF0B">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="Order Monkey"
Description="Order Monkey Orders and Quotes"
Target="[USERSPECIFIEDDIR]OrderMonkey.exe"
WorkingDirectory="USERSPECIFIEDDIR" />
<Shortcut Id="ApplicationOfflineStartMenuShortcut"
Name="Order Monkey Offline"
Description="Order Monkey Orders and Quotes"
Target="[USERSPECIFIEDDIR]OrderMonkey.exe"
WorkingDirectory="USERSPECIFIEDDIR"
Arguments="-offline" />
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\OrderMonkey" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Feature Id='Complete' Level='1' Title='Order Monkey Complete' Description='The complete package' ConfigurableDirectory='TARGETDIR' Display='expand'>
<ComponentRef Id='MainExe' />
<ComponentRef Id='OMEmailerExe' />
<ComponentRef Id='migradomDLL' />
<ComponentRef Id='migrarenderDLL' />
<ComponentRef Id='migrartfDLL' />
<ComponentRef Id='mysqldataDLL' />
<ComponentRef Id='pdfchartingDLL' />
<ComponentRef Id='pdfsharpDLL' />
<ComponentRef Id='sqliteDLL' />
<ComponentRef Id='ApplicationShortcut' />
<ComponentRef Id='AppData' />
</Feature>
Use these elements:
<Package Compressed="yes" InstallScope="perMachine" />
<MediaTemplate EmbedCab="yes" />
Package/#Compressed="yes" creates cabinets instead of loose files. MediaTemplate/#EmbedCab="yes" embeds the default cabinets into the .msi.

Resources