Component testcomp installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file
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.