سؤال

I have a problem with UAC rights, here is my config:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <?define ProductName="AXClpb" ?>
  <?define ProductVersion="1.0.0.0" ?>
  <?define ProductCode="*"?>
  <?define UpgradeCode="7352E479-0BEA-4055-B9E1-9699195DA4FB"?>
  <?define Manufacturer="Aeroclub"?>

  <Product Id="$(var.ProductCode)" Name="$(var.ProductName)" Language="1049" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
    <Package InstallerVersion="200" Compressed="yes" InstallPrivileges="elevated" InstallScope="perMachine" />
    <Media Id="1" Cabinet="AXClpb.cab" EmbedCab="yes" />

    <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
    <Upgrade Id="$(var.UpgradeCode)">
      <UpgradeVersion
         Minimum="1.0.0.0" Maximum="99.0.0.0"
         Property="PREVIOUSVERSIONSINSTALLED"
         IncludeMinimum="yes" IncludeMaximum="no" />
    </Upgrade>

    <InstallExecuteSequence>
      <RemoveExistingProducts Before="InstallInitialize" />
      <Custom Action="RegisterClipboardActiveX" Before="InstallFinalize">Installed</Custom>
      <Custom Action="UnregisterClipboardActiveX" Before="RemoveFiles">Installed</Custom>
    </InstallExecuteSequence>

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="ManufacturerFolder" Name="$(var.Manufacturer)">
          <Directory Id="INSTALLLOCATION" Name="$(var.ProductName)">
            <Component Id="ProductComponent1" Guid="A85287B1-2589-499E-91BD-83245242A648">
              <File Id='ClipboardActiveXDLL' Name='ClipboardActiveX.dll' Source='..\ClipboardActiveX\bin\Release\ClipboardActiveX.dll' Vital='yes' />
              <File Id='SetupInf' Name='setup.inf' Source='setup.inf' Vital='yes' />
              <RemoveFolder Id="INSTALLLOCATION" On="uninstall" />
            </Component>

            <Directory Id="Regasm" Name="Regasm">
              <Component Id="ProductComponent2" Guid="BC68B576-232D-42E1-AE82-DC2BF8A170F1">
                <File Id='RegAsmExe' Name='RegAsm.exe' Source='regasm\RegAsm.exe' Vital='yes' />
                <File Id='RegAsmExeConfig' Name='RegAsm.exe.config' Source='regasm\RegAsm.exe.config' Vital='yes' />
              </Component>
            </Directory>

            <Directory Id="Elevation" Name="Elevation">
              <Component Id="ProductComponent3" Guid="728D7ADD-E122-4289-A8A9-F2D482743EB5">
                <File Id='Elevate32Exe' Name='Elevate32.exe' Source='elevation\Elevate32.exe' Vital='yes' />
                <File Id='Elevate64Exe' Name='Elevate64.exe' Source='elevation\Elevate64.exe' Vital='yes' />
                <File Id='IsElevated32Exe' Name='IsElevated32.exe' Source='elevation\IsElevated32.exe' Vital='yes' />
                <File Id='IsElevated64Exe' Name='IsElevated64.exe' Source='elevation\IsElevated64.exe' Vital='yes' />
              </Component>
            </Directory>
          </Directory>
        </Directory>
      </Directory>
    </Directory>

    <CustomAction Id="RegisterClipboardActiveX" Directory="INSTALLLOCATION" ExeCommand="[SystemFolder]cmd.exe /C start start.bat" Return="check" Impersonate="no" Execute="deferred" />
    <CustomAction Id="UnregisterClipboardActiveX" Directory="INSTALLLOCATION" ExeCommand="[SystemFolder]cmd.exe /C start RegAsm.exe ClipboardActiveX.dll /u " Return="asyncNoWait" Impersonate="no" Execute="deferred" />

    <Feature Id="ProductFeature" Title="ClipboardActiveX" Level="1">
      <ComponentRef Id="ProductComponent1" />
      <ComponentRef Id="ProductComponent2" />
      <ComponentRef Id="ProductComponent3" />
    </Feature>
  </Product>
</Wix>

Anybody can provide me a full answer how to run my custom actions with UAC Administrator privilegies?

I know about elevate.exe, but I search more elegant way to do this.

I'm very appreciate your help!

UPDATE1: Split all to several components

هل كانت مفيدة؟

المحلول

This isn't an answer to your question but it should help you author the installer...

First, a few things you should consider:

  • RegAsm.exe is probably not licensed for distribution in the way you are doing it.
  • Components generally should have zero or one File elements. Read about component design and "Component Rules"; start here.
  • The registry should be changed through standard Windows Installer tables and actions, not by executables that operate outside of Windows Installer's tracking. Whenever possible, the registry changes should be in the same component as the file being registered—that way, they are sure to come and go together.

WiX's heat tool will generate authoring for .NET assemblies. If you are using Visual Studio and/or MSBuild to run WiX, you can use the HarvestFile or HarvestProject tecnhiques (see the documentation).

Or, via the command-line:

heat file ..\ClipboardActiveX\bin\Release\ClipboardActiveX.dll -out ClipboardActiveX.wxs

or

heat project ..\ClipboardActiveX\ClipboardActiveX.csproj -out ClipboardActiveX.wxs
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top