WiX 工具集 PermissionEx 问题 - 安装后应用程序没有 运行
WiX Toolset PermissionEx Problem - App Does Not Run After Installation
我在 Wpf/C# 中有一个应用程序,我使用 WiX 工具集创建了一个安装程序。安装程序适用于所有经过测试的计算机,不会显示任何错误消息。但是,在某些机器上,应用程序在安装后不会 运行,即使是管理员用户。我相信这是一些许可问题,但我不确定。如何授予当前用户权限?
更新:
到目前为止,该问题只发生在两台 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>
Permissions: As commented above, maybe do a quick check to see if the permissions are applied correctly as described here: Checking
permissions.
Runtime Dependency / Requirement: If this happens on very few machines one would think the cause to be a runtime requirement that is
not met. Are you sure you have the visual studio C++ runtime installed
on the computers in question? Or some other runtime requirement?
调试启动问题:有几个较旧的答案以及有关调试的建议。既然我看着它们,它们是如此相似,以至于我需要停止以不同的方式重复自己:
- Application Launch Issues Check List(想法列表)
- Launch debug binaries and attach debugger - and dependency scanner tools(哪些winform工程文件要打包进安装程序)
- Visual Studio installer fails on AspNetDiagnosticPack.msi
- The setup process in windows fails access denied when trying to create "uc.micro" folder
- Create a .config folder in the user folder
- EXE file is not working
Procedure:简而言之,我会尝试确定是否缺少运行时。您可以使用 procmon.exe
或 dependency walker
来检查这一点。您还可以使用上述调试方法构建调试二进制文件并在启动期间连接到二进制文件。前提是二进制文件完全脱离地面。
我在 Wpf/C# 中有一个应用程序,我使用 WiX 工具集创建了一个安装程序。安装程序适用于所有经过测试的计算机,不会显示任何错误消息。但是,在某些机器上,应用程序在安装后不会 运行,即使是管理员用户。我相信这是一些许可问题,但我不确定。如何授予当前用户权限?
更新: 到目前为止,该问题只发生在两台 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>
Permissions: As commented above, maybe do a quick check to see if the permissions are applied correctly as described here: Checking permissions.
Runtime Dependency / Requirement: If this happens on very few machines one would think the cause to be a runtime requirement that is not met. Are you sure you have the visual studio C++ runtime installed on the computers in question? Or some other runtime requirement?
调试启动问题:有几个较旧的答案以及有关调试的建议。既然我看着它们,它们是如此相似,以至于我需要停止以不同的方式重复自己:
- Application Launch Issues Check List(想法列表)
- Launch debug binaries and attach debugger - and dependency scanner tools(哪些winform工程文件要打包进安装程序)
- Visual Studio installer fails on AspNetDiagnosticPack.msi
- The setup process in windows fails access denied when trying to create "uc.micro" folder
- Create a .config folder in the user folder
- EXE file is not working
Procedure:简而言之,我会尝试确定是否缺少运行时。您可以使用 procmon.exe
或 dependency walker
来检查这一点。您还可以使用上述调试方法构建调试二进制文件并在启动期间连接到二进制文件。前提是二进制文件完全脱离地面。