WiX Toolset PermissionEx问题-安装后应用无法运行

时间:2018-11-17 19:44:24

标签: c# wpf wix

我在Wpf / C#中有一个应用程序,并且使用WiX Toolset创建了一个安装程序。安装程序可在所有经过测试的计算机上运行,​​并且不会显示任何错误消息。但是,在某些计算机上,即使使用管理员用户,该应用程序也不会在安装后运行。我相信这是一些权限问题,但我不确定。如何授予当前用户权限?

更新: 到目前为止,该问题仅在装有Windows 10 Home的两台计算机上发生。我以为可能是我设置的InstallerVersion。

以下是最相关的代码段。

非常欢迎任何帮助。谢谢。

<Product Id="{2A173950-... }"
       Codepage="UTF-8"
       Name="Xyz"
       Language="1033"
       Version="1.0"
       Manufacturer="Xyz Software"
       UpgradeCode="{8B843496-... }">

<Package InstallerVersion="301"
         Compressed="yes"
         InstallScope="perMachine"
         Manufacturer="Xyz Software"
         Description="Xyz Installer"
         Keywords="Practice,Installer,MSI"
         Comments="(c) 2018, Xyz Software" />

<Feature Id="ProductFeature" Title="Xyz Installer" Level="1">
  <ComponentGroupRef Id="ApplicationComponents" />
  <ComponentGroupRef Id="DataComponents" />
  <ComponentGroupRef Id="SavedFilesEmptyFolder" />
  <ComponentGroupRef Id="StartMenuComponents" />
  <ComponentGroupRef Id="DesktopComponents" />
</Feature>

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
  <!--Program Files Folder-->
  <Directory Id="ProgramFilesFolder">
    <Directory Id="CompanyFolder" Name="Xyz Software" >
      <Directory Id="ApplicationFolder" Name="Xyz" >
        <Directory Id="DataFolder" Name="Data" >
          <Directory Id="SavedFilesFolder" Name="Saved Files" />
        </Directory>
      </Directory>
    </Directory>
  </Directory>
  <!--Start Menu-->
  <Directory Id="ProgramMenuFolder">
    <Directory Id="StartMenuFolder" Name="Xyz" />
  </Directory>
  <!--Desktop-->
  <Directory Id="DesktopFolder" Name="Desktop" />
</Directory>

<Fragment>
<ComponentGroup Id="ApplicationComponents" Directory="ApplicationFolder">
  <Component Id="CmpXyzExe" Guid="{1EA7372D-... }">
    <File Id="FilXyzExe" Source="Xyz.exe" KeyPath="yes" />
  </Component>
  <Component Id="CmpSetPermissionsApp" Guid="{36CDCE9A-... }" >
    <CreateFolder>
      <util:PermissionEx User="Administrators" GenericAll="yes" />
      <util:PermissionEx User="Users" GenericAll="yes" />
    </CreateFolder>
  </Component>
</ComponentGroup>

<ComponentGroup Id="DataComponents" Directory="DataFolder">
  <Component Id="CmpXyzDic" Guid="{A32B6F47-... }">
    <File Id="FilXyzDic" Source="Xyz.dic"  />
  </Component>
</ComponentGroup>


<Fragment>
<ComponentGroup Id="StartMenuComponents" Directory="StartMenuFolder">
  <Component Id="CmpStartMenuShortcuts" Guid="{818AD65E-... }">
    <CreateFolder />
    <Shortcut Id="SctApplication"
              Name="Xyz"
              Target="[ApplicationFolder]Xyz.exe" />
    <Shortcut Id="SctUninstall"
              Name="Uninstall Xyz"
              Description="Uninstalls Xyz and all of its components"
              Target="[System64Folder]msiexec.exe"
              Arguments="/x [ProductCode]" />
    <RemoveFolder Id="RmvStartMenuComponents"
                  On="uninstall" />
    <RegistryValue Root="HKCU"
                   Key="Software\Microsoft\Xyz"
                   Name="installed"
                   Type="integer"
                   Value="1"
                   KeyPath="yes" />
  </Component>
</ComponentGroup>

<Fragment>
<ComponentGroup Id="DesktopComponents" Directory="DesktopFolder">
  <Component Id="CmpDesktopShortcuts" Guid="{4FC34354-... }">
    <Shortcut Id="SctApplicationDesktop"
              Name="Xyz"
              Target="[ApplicationFolder]Xyz.exe" />
    <RemoveFolder Id="RmvDesktopComponents"
                  On="uninstall" />
    <RegistryValue Root="HKCU"
                   Key="Software\Microsoft\Xyz"
                   Name="installed"
                   Type="integer"
                   Value="1"
                   KeyPath="yes" />
  </Component>
</ComponentGroup>

1 个答案:

答案 0 :(得分:0)

  

权限 :如上所述,也许可以快速检查一下权限是否正确应用,如此处所述:Checking permissions

     

运行时依赖项/要求 :如果这种情况在很少的计算机上发生,人们会认为原因是运行时要求   没见过。您确定已安装Visual Studio C ++运行时   在有问题的计算机上?还是其他一些运行时要求?

调试启动问题 :有一些较旧的答案,其中包含调试建议。现在,我看着它们是如此相似,以至于我需要停止以不同的风格重复自己了:

过程 :简而言之,我将尝试确定是否缺少运行时。您可以使用procmon.exedependency walker进行检查。您还可以使用上面描述的调试方法,在调试过程中生成调试二进制文件并在启动期间连接到二进制文件。只要二进制文件完全脱离地面。