2016-11-17 43 views
1

我正在创建x64 msi。我有一些注册表值要设置。在Wix中,我使用下面的代码。注册表项在Wix中无法正常工作

<Component Id="RegistryEntries1" Guid="{GUID1}" Win64="yes"> 
    <RegistryKey Root="HKLM" 
       Key="Software\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{FF.....}" 
       Action="createAndRemoveOnUninstall"> 
     <RegistryValue Type="string" Value="SomeName" KeyPath="yes"/> 
    </RegistryKey> 
    </Component> 


    <Component Id="RegistryEntries2" Guid="{GUID2}" Win64="yes"> 
    <RegistryKey Root="HKCR" 
        Key="CLSID\{FF.....}" 
        Action="createAndRemoveOnUninstall"> 
     <RegistryValue Type="string" Value="SomeName" KeyPath="yes"/> 
    </RegistryKey> 
    </Component> 


    <Component Id="RegistryEntries3" Guid="{GUID3}" Win64="yes"> 
    <RegistryKey Root="HKCR" 
        Key="CLSID\{{FF.....}\InprocServer32" 
        Action="createAndRemoveOnUninstall"> 
     <RegistryValue Type="string" Value="SomeName.dll" KeyPath="no"/> 
     <RegistryValue Type="string" Name="ThreadingModel" Value="Apartment" KeyPath="yes"/> 
    </RegistryKey> 
    </Component> 

这些值在注册表中设置,但我的应用程序无法正常工作。

当我使用reg文件设置注册表值时,应用程序正常工作。

而且我SomeName.dll是在System32中

Windows Registry Editor Version 5.00 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{FF.....}] 
@="SomeName" 

[HKEY_CLASSES_ROOT\CLSID\{FF.....}] 
@="SomeName" 

[HKEY_CLASSES_ROOT\CLSID\{FF.....}\InprocServer32] 
@="SomeName.dll" 
"ThreadingModel"="Apartment" 

有没有在我的维克斯代码中的任何问题。

+0

您的应用程序可能作为服务运行吗?或者作为另一个帐户运行? – PhilDW

+0

@PhilDW是的。我的应用程序是一个服务安装程序。 –

回答

2

这个问题很可能是HKCR是一个虚拟键,在你的情况下是HKLM \ Software \ Classes和HKCU \ Software \ Classes的合并视图。这就解释了它:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms724475(v=vs.85).aspx

所以与本地系统帐户运行的是没有看到这些。如果你使用系统帐户运行注册表,如果这是发生的事情,你将看不到你的HKCR类。

因此,如果您在HKLM \ Software \ Classes中进行输入,我认为您的服务/服务安装程序代码会看到它们。 ServiceInstaller类通常以系统帐户的自定义操作运行。如果您使用的是WiX,则不需要ServiceInstaller类(可能是从Visual Studio设置进行迁移),因为ServiceInstall和ServiceControl可以完成这项工作。

+0

谢谢....工作... –