0
votes

My WIX installer has 2 fragments, one going to x64 Program Files and that is working fine. I'm trying to use heat to also generate a wxs fragment for files that need to go to something like

"C:\Users\Public\Documents\MyAppPublic"

In the .wixproj file, I have following BeforeBuild code:

<Target Name="BeforeBuild">
    <HeatDirectory 
        Directory="$(SolutionDir)\..\..\MyApp\MyApp.Application\bin" 
        OutputFile="$(SolutionDir)\..\MyApp\Fragments\InstallFiles.wxs" 
        ComponentGroupName="MyAppInstallFilesComponentGroup" 
        DirectoryRefId="MYAPPINSTALLDIRECTORY" 
        PreprocessorVariable="var.ProjectSourceFilesDir" 
        AutogenerateGuids="true" 
        ToolPath="$(SolutionDir)\..\tools\3.10\binaries" 
        SuppressFragments="true" 
        SuppressCom="true" 
        SuppressRegistry="true" 
        SuppressRootDirectory="true" 
        Transforms="$(SolutionDir)\..\MyApp\Transforms\InstallFilesExclude.xsl" />
    <HeatDirectory 
        Directory="$(SolutionDir)\..\..\MyAppPublicDocsSourceFiles" 
        OutputFile="$(SolutionDir)\..\MyApp\Fragments\MyAppPublicDocsFiles.wxs" 
        ComponentGroupName="MyAppPublicFilesComponentGroup" 
        DirectoryRefId="MYAPPPUBLICDIRECTORY" 
        PreprocessorVariable="var.MyAppPublicDocsSourceDir" 
        AutogenerateGuids="true" 
        ToolPath="$(SolutionDir)\..\tools\3.10\binaries" 
        SuppressFragments="true" 
        SuppressCom="true" 
        SuppressRegistry="true" 
        SuppressRootDirectory="true"/>
</Target>

My MyAppPublicDocsFiles.wsx file is getting populated. I'm using Visual Studio to compile the solution containing my .wixproj file. The error I'm seeing is:

1>C:\Users\user.name\...\MyApp\Fragments\MyAppPublicDocsFiles.wxs(55,0): error LGHT0231: 
   The component 'cmp415810817DCD69555E8A9CBFB0AA536A' has a key file with path 
   'TARGETDIR\publicdocs\MyAppPublicDocs\file1.txt'.  
   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.)
1>Done building project "MyApp.wixproj" -- FAILED.

Repeated for each file in my public documents source directory.

This is my .wixproj code:

<PropertyRef Id="WIX_DIR_COMMON_DOCUMENTS"/>

<Feature Id='MyAppInstallFiles' Title='MyApp Install Files' Description='The application'>
  <Feature Id='ApplicationFiles' Title='MyApp Application Files' Description='Application Files' Level='1'>
    <ComponentGroupRef Id='MyAppInstallFilesComponentGroup' />
  </Feature>
</Feature>

<Feature Id='MyAppPublicDocFiles' Title='PublicDoc Files' Description='Data files'>
  <Feature Id='PublicDocFiles' Title='PublicDoc  Files' Description='Data files' Level='1'  ConfigurableDirectory='MYAPPPUBLICDIRECTORY'>
    <ComponentGroupRef Id='MyAppPublicDocFilesComponentGroup' />
  </Feature>
</Feature>

<Directory Id='TARGETDIR' Name='SourceDir'>
  <Directory Id='ProgramFiles64Folder' Name='PFiles'>
    <Directory Id='$(var.ShortManufacturer)' Name='$(var.ShortManufacturer)'>
      <Directory Id='SOLIDXINSTALLDIRECTORY' Name='$(var.ProductName)'>
      </Directory>
    </Directory>
  </Directory>      
  <Directory Id="WIX_DIR_COMMON_DOCUMENTS" Name="PublicDocs">
    <Directory Id='MYAPPPUBLICDIRECTORY' Name='$(var.PublicDocName)'/>
  </Directory>
</Directory>

How do I interpret this error message? In summary, I'm trying to install WIX fragment files to a public documents location. This question has the files directly in the .wixproj and listed under that XML node. My files are coming from heat.exe.

1

1 Answers

1
votes

To use automatic GUID generation the path has to be rooted at build time. WIX_DIR_COMMON_DOCUMENTS is not assigned until install time.

You could fix this by root it at build time under, say, [CommonAppDataFolder].