title: Should I allow heat to generate guids? Getting an error when I try auto-generate during compile because I am not using a standard directory
body: <p>My first question is, should I work to get the compiler working with auto-generated guids?</p>
  
  <p>I am trying to create an installer for a website with WiX. Please excuse my ignorance, this is my first WiX project. I am following this article: </p>
  
  <p><a href="http://blog.bartdemeyer.be/2013/10/create-an-installer-for-website-with-wix-part-1/" rel="noreferrer">http://blog.bartdemeyer.be/2013/10/create-an-installer-for-website-with-wix-part-1/</a></p>
  
  <p>The process uses msbuild to call several WiX tools to ultimately create an MSI. The example uses "Generate guids now" (the "-gg" switch) when calling heat:</p>
  
  <pre><code>&lt;Target Name="Harvest"&gt;
      &lt;!-- Harvest all content of published result --&gt;
      &lt;Exec
          Command='"$(WiX)bin\heat.exe" dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg MgrWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)'
          ContinueOnError="false"
          WorkingDirectory="." /&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>I was reading elsewhere it is best practice to use auto-generated guids (the -ag switch) to ensure product updates install correctly. I notice the guids change every time heat is run. </p>
  
  <pre><code>&lt;Fragment&gt;
      &lt;ComponentGroup Id="MgrWebComponents"&gt;
          &lt;Component Id="cmp56294569B275493319100C26538BA16C" Directory="INSTALLFOLDER" Guid="{A43DA07B-C4CD-4FE0-AC09-EEA693AB2BA7}"&gt;
              &lt;File Id="fil93D55732EC03C2B809F21B9423BF5550" KeyPath="yes" Source="$(var.publishDir)\BrandImageService.ashx" /&gt;
          &lt;/Component&gt;
          &lt;Component Id="cmp6BD39B2D572EA73C29A81AE5D1C3F0C4" Directory="INSTALLFOLDER" Guid="{99B7B916-AEC0-4EE9-B17F-E7B325E93A4D}"&gt;
              &lt;File Id="filE861424851E26D456D43F5D1855B3E7B" KeyPath="yes" Source="$(var.publishDir)\Dashboard.aspx" /&gt;
          &lt;/Component&gt;
  ...
  </code></pre>
  
  <p>If I should use auto-generated guids I need to get the compiler working. I am getting errors for every file for trying to use auto-generated guids when compiling.</p>
  
  <blockquote>
    <p>LGHT0231: The component 'cmp2BE6B5C092821452E1438D39A5110DDB' has a
    key file  with path 'TARGETDIR\inetpub\manager\tools\toolshome.aspx'. 
    Since this path  is not rooted in one of the standard directories
    (like ProgramFilesFolder),  this component does not fit the criteria
    for having an automatically generated  guid.  (This error may also
    occur if a path contains a likely standard directory such as nesting a
    directory with name "Common Files" under ProgramFilesFolder.)</p>
  </blockquote>
  
  <p>My directory fragment is:</p>
  
  <pre><code>&lt;Fragment&gt;
      &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
          &lt;Directory Id="INETPUB" Name="Inetpub"&gt;
              &lt;Directory Id="INSTALLFOLDER" Name="Manager" /&gt;
          &lt;/Directory&gt;
      &lt;/Directory&gt;
  &lt;/Fragment&gt;
  </code></pre>
  
  <p>The heat generated fragment looks like:</p>
  
  <pre><code>&lt;Fragment&gt;
      &lt;ComponentGroup Id="MgrWebComponents"&gt;
          &lt;Component Id="cmp56294569B275493319100C26538BA16C" Directory="INSTALLFOLDER" Guid="*"&gt;
              &lt;File Id="fil93D55732EC03C2B809F21B9423BF5550" KeyPath="yes" Source="$(var.publishDir)\BrandImageService.ashx" /&gt;
          &lt;/Component&gt;
          &lt;Component Id="cmp6BD39B2D572EA73C29A81AE5D1C3F0C4" Directory="INSTALLFOLDER" Guid="*"&gt;
              &lt;File Id="filE861424851E26D456D43F5D1855B3E7B" KeyPath="yes" Source="$(var.publishDir)\Dashboard.aspx" /&gt;
          &lt;/Component&gt;
  ...
  </code></pre>
  
  <p>The targets for msbuild:</p>
  
  <pre><code>&lt;Target Name="Build"&gt;
      &lt;!-- Compile whole solution in release mode --&gt;
      &lt;MSBuild
          Projects="..\Manager.sln"
          Targets="ReBuild"
          Properties="Configuration=Release" /&gt;
  &lt;/Target&gt;
  
  &lt;Target Name="PublishWebsite"&gt;
      &lt;!-- Remove complete publish folder in order to 
              be sure that everything will be newly compiled --&gt;
      &lt;Message Text="Removing publish directory: $(SetupF)"/&gt;
      &lt;RemoveDir Directories="$(SetupF)" ContinueOnError="false" /&gt;
      &lt;Message Text="Start to publish website" Importance="high" /&gt;
      &lt;MSBuild
          Projects="..\\Manager\UI\Manager.UI.csproj"
          Targets="ResolveReferences;_CopyWebApplication"
          Properties="OutDir=$(Publish)bin\;WebProjectOutputDir=$(Publish);Configuration=Release" /&gt;
  &lt;/Target&gt;
  
  &lt;Target Name="Harvest"&gt;
      &lt;!-- Harvest all content of published result --&gt;
      &lt;Exec
          Command='"$(WiX)bin\heat.exe" website $(Publish) -dr INSTALLFOLDER -ke -srd -cg MgrWebComponents -var var.publishDir -ag -out $(WebSiteContentCode)'
          ContinueOnError="false"
          WorkingDirectory="." /&gt;
  &lt;/Target&gt;
  
  &lt;Target Name="WIX"&gt;
      &lt;!--     At last create an installer --&gt;
      &lt;Message Text="TEST: @(WixCode)"/&gt;
      &lt;Exec
          Command='"$(WiX)bin\candle.exe" -dpublishDir=$(Publish) -dMgrWebResourceDir=. @(WixCode, &amp;apos; &amp;apos;)'
          ContinueOnError="false"
          WorkingDirectory="." /&gt;
      &lt;Exec
          Command='"$(WiX)bin\light.exe" -spdb -out $(MsiOut) @(WixObject, &amp;apos; &amp;apos;)'
          ContinueOnError="false"
          WorkingDirectory="." /&gt;
  
      &lt;!-- A message at the end --&gt;
      &lt;Message Text="Install package has been created." /&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>The build command is: <code>msbuild /t:Build;PublishWebsite;Harvest;WIX setup.build</code></p>
  
  <p>I understand the generated guid uses the seed of the directory. Should I change the location of the directory?</p>
  
  <p>Thank you!!</p>