Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Component testcomp installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file

Tags:

wix

I'd like to copy a file under a Doucments location in WiX. But it gives the warning:

Component testcomp installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file.

My code:

<Directory Id='PersonalFolder' Name='MyDocuments'>
   <Component Id='testcomp' Guid='08C288B6-D8E0-4036-9CEB-E5F616AC6B5C'>
      <File Id='doc_code_file1' Name='doc_code_file1' DiskId='1'
            Source='Personalfolder\Visual Studio 2012\Code Snippets\Visual C#\My Code Snippets\SimpleMvvm\mvvmcommand.snippet' KeyPath='yes'></File>
   </Component>
</Directory>
like image 602
Smaug Avatar asked Apr 20 '13 11:04

Smaug


1 Answers

That's correct. The Windows Installer wants registry keys as the key paths for per-user Components. It has to do with the way profiles work with advertised content in enterprise deployments. The fix is very straight forward:

<Directory Id='PersonalFolder' Name='MyDocuments'>
   <Component Id='testcomp' Guid='08C288B6-D8E0-4036-9CEB-E5F616AC6B5C'>

      <RegistryValue Root='HKCU' Key='Software\Manufacturer\Product'
                     Name='Something (I like to use InstallFolder)'
                     Value='Something (I like to use [INSTALLFOLDER]'
                     Type='string'
                     KeyPath='yes' />

      <File Id='doc_code_file1' Name='doc_code_file1' DiskId='1'
            Source='Personalfolder\Visual Studio 2012\Code Snippets\Visual C#\My Code Snippets\SimpleMvvm\mvvmcommand.snippet' />
   </Component>
</Directory>

Note: The added per-user registry key and that it is marked KeyPath='yes'. The latter is not explicitly necessary since it's the first resource in the Component which will be marked as the key path by default, but being explicit with the key path is sometimes better.

like image 142
Rob Mensching Avatar answered Oct 25 '22 00:10

Rob Mensching