Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
194 views
in Technique[技术] by (71.8m points)

c# - WiX Toolset PermissionEx Problem - App Does Not Run After Installation

I have an application in Wpf/C# and I created an installer with the WiX Toolset. The installer works on all tested computers, it does not display any error messages. However, on some machines, the application does not run after installation, even with an administrator user. I believe it's some permission problem, but I'm not sure. How do I give permissions to the current user?

UPDATE: So far the problem has only occurred on two machines with Windows 10 Home. I thought it might be the InstallerVersion that I set.

Below are the most relevant code snippets.

Any help is very welcome. Thank you.

<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="SoftwareMicrosoftXyz"
                   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="SoftwareMicrosoftXyz"
                   Name="installed"
                   Type="integer"
                   Value="1"
                   KeyPath="yes" />
  </Component>
</ComponentGroup>

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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?

Debugging Launch Issues: There are several older answers with suggestions on debugging. Now that I look at them they are so similar that I need to stop repeating myself in different flavors:

Procedure: In brief I would try to determine if there is a missing runtime. You can use procmon.exe or dependency walker to check for this. You can also use the debugging approach described above where you build debug binaries and connect to the binaries during launch. Provided the binary gets off the ground at all.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...