title: Create a Wix installer for a solution with multiple projects
body: <p>I have a Wpf solution that is composed of 2 projects one of them is the windows application and the other is a class library. When I try to create the installer it works fine but when I run the app it crashes.
  When I put all the code in a single project it all works just fine.</p>
  
  <p>So, how do I make it work when there are multiple projects?</p>
  
  <p>My Product.wxs is:</p>
  
  <pre><code>&lt;Product Id="8748CF04-E8D3-4A2B-B3F5-22E50B3A8E49"
         Name="MyApp" Language="1033" Version="1.0.0.0" Manufacturer="My System Pvt Ltd"
         UpgradeCode="8748CF04-E8D3-4A2B-B3F5-22E50B3A8E49"&gt;
  
  &lt;Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
            InstallPrivileges="elevated" ReadOnly="yes"/&gt;
  
  &lt;MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /&gt;
  &lt;!--Add Cab1.cab File inside the Package--&gt;
  &lt;Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" /&gt;
  
  &lt;!--Here We Install Our Main App--&gt;
  &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
    &lt;Directory Id="ProgramFilesFolder"&gt;
      &lt;Directory Id="INSTALLFOLDER" Name="MY System Pvt Ltd"/&gt;
    &lt;/Directory&gt;
  
    &lt;!-- Step 1: For the Program Menu --&gt;
    &lt;Directory Id="ProgramMenuFolder"&gt;
      &lt;Directory Id="ApplicationProgramsFolder" Name="My System Pvt Ltd"/&gt;
    &lt;/Directory&gt;
  
    &lt;!--Step 2:For Desktop Folder--&gt;
    &lt;Directory Id="DesktopFolder"/&gt;
  
    &lt;!--Step 3:For StartUp Folder--&gt;
    &lt;Directory Id="StartupFolder"/&gt;
  
  &lt;/Directory&gt;
  
  &lt;!--Step 4 :Add Main App exe--&gt;
  &lt;DirectoryRef Id="INSTALLFOLDER"&gt;
    &lt;Component Id="myapplication.exe" Guid="84C5B9E8-FD90-4EA8-A502-B08AC9B38D39"&gt;
      &lt;File Source="C:\Users\petric\Downloads\Compressed\WixDemoWPFAppVS2012\WixDemoWPFAppVS2012\WixDemoWPFAppVS2012\WpfApplication2\bin\Debug\WpfApplication2.exe" Name="MYApp.exe"
            Id="MyAppEXE" KeyPath="yes"/&gt;
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  
  &lt;!-- Step 1.1: Add the shortcut to your installer package Program Menu or Start Menu--&gt;
  &lt;DirectoryRef Id="ApplicationProgramsFolder"&gt;
    &lt;Component Id="ApplicationShortcut" Guid="1A437020-D5C9-450C-9B3D-33957994780A"&gt;
      &lt;!--Add Shortcut of the Application in start Menu--&gt;
      &lt;Shortcut Id="ApplicationStartMenuShortcut" Name="MyApp" Description="My Application Description"
          Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER"&gt;
        &lt;!--Add Icon to the ShortCut--&gt;
        &lt;Icon Id="MYPMenuIcon"  SourceFile=".\Desktop.ico" /&gt;
      &lt;/Shortcut&gt;
      &lt;!--Remove the Folder At time of Uninstall--&gt;
      &lt;RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/&gt;
      &lt;RegistryValue Root="HKCU"  Key='Software\[Manufacturer]\[ProductName]'
                     Name="installed" Type="integer" Value="1" KeyPath="yes"/&gt;
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  
  &lt;!-- Step 2.1: Add the shortcut to your installer package For DeskTop--&gt;
  &lt;DirectoryRef Id="DesktopFolder"&gt;
    &lt;Component Id="ApplicationDeskShortcutComp" Guid="40127963-856D-460D-9E1B-4C10EB65835B"&gt;
      &lt;Shortcut Id="ApplicationDeskShortcut" Name="MYAppDesk"
                Description="My Application Description" Target="[INSTALLFOLDER]MyApp.exe"
                WorkingDirectory="INSTALLFOLDER"&gt;
        &lt;Icon Id="MYDeskIcon"  SourceFile=".\Desktop.ico" /&gt;
      &lt;/Shortcut&gt;
      &lt;RemoveFolder Id="DesktopFolder" On="uninstall"/&gt;
      &lt;RegistryValue Root="HKCU"  Key='Software\[Manufacturer]\[ProductName]'
                     Name="installed" Type="integer" Value="1" KeyPath="yes"/&gt;
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  
  &lt;!--Step 3.1: add Shortcut to StartUp Folder to run application when you login--&gt;
  &lt;DirectoryRef Id="StartupFolder"&gt;
    &lt;Component Id="ApplicationStartUpShortcutComp" Guid="843B6A2E-AB61-40C7-BE49-FBCD7F81E35D"&gt;
      &lt;Shortcut Id="ApplicationStartUpDeskShortcut" Name="MYAppDesk" Description="My Application Description"
          Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER"&gt;
        &lt;Icon Id="MyIconStartUp"  SourceFile=".\Desktop.ico" /&gt;
      &lt;/Shortcut&gt;
      &lt;RemoveFolder Id="StartupFolder" On="uninstall"/&gt;
      &lt;RegistryValue Root="HKCU"  Key='Software\[Manufacturer]\[ProductName]'  
                     Name="installed" Type="integer" Value="1" KeyPath="yes"/&gt;
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  
  &lt;!--Add Component--&gt;
  &lt;Feature Id="MainApplication" Title="Main Application" Level="1"&gt;
    &lt;ComponentRef Id="myapplication.exe" /&gt;
    &lt;!--Step 1.2:Add Start menu or program  Shortcut--&gt;
    &lt;ComponentRef Id="ApplicationShortcut" /&gt;
    &lt;!--step 2.2Add DeskTop Shortcut--&gt;
    &lt;ComponentRef Id="ApplicationDeskShortcutComp" /&gt;
    &lt;!--step 3.2Add DeskTop Shortcut--&gt;
    &lt;ComponentRef Id="ApplicationStartUpShortcutComp"/&gt;
  &lt;/Feature&gt;
  </code></pre>
  
  <p></p>
  
  <p>I followed this tutorial :
  <a href="http://www.c-sharpcorner.com/UploadFile/cb88b2/getting-started-with-wix-windows-installer-xml-in-vs2012/" rel="nofollow">http://www.c-sharpcorner.com/UploadFile/cb88b2/getting-started-with-wix-windows-installer-xml-in-vs2012/</a></p>