组件 testcomp 安装到用户配置文件.它必须使用 HKCU 下的注册表项作为其 KeyPath,而不是文件 [英] Component testcomp installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file

查看:30
本文介绍了组件 testcomp 安装到用户配置文件.它必须使用 HKCU 下的注册表项作为其 KeyPath,而不是文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 WiX 中的文档位置下复制一个文件.但它给出了警告:

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

组件 testcomp 安装到用户配置文件.它必须使用 HKCU 下的注册表项作为其 KeyPath,而不是文件.

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

我的代码:

<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>

推荐答案

没错.Windows 安装程序希望将注册表项作为每用户组件的键路径.它与配置文件在企业部署中处理广告内容的方式有关.修复非常简单:

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>

注意:添加的每用户注册表项并标记为 KeyPath='yes'.后者不是明确必要的,因为它是组件中的第一个资源,默认情况下将被标记为关键路径,但有时明确地使用关键路径会更好.

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.

这篇关于组件 testcomp 安装到用户配置文件.它必须使用 HKCU 下的注册表项作为其 KeyPath,而不是文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆