Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wix 安装完成并打开UAC后启动应用程序_Wix_Uac_Wix3_Launch - Fatal编程技术网

Wix 安装完成并打开UAC后启动应用程序

Wix 安装完成并打开UAC后启动应用程序,wix,uac,wix3,launch,Wix,Uac,Wix3,Launch,你好 我一直在使用WIX(Windows installer XML)技术为我们的产品构建安装程序。如果在安装后选中该复选框,则预期的行为是启动产品 这已经运行了一段时间了,但我们最近发现Win7的UAC和Vista正在阻止该应用程序的启动。我做了一些研究,有人建议我应该添加属性 执行class='deferred'并模拟class='no' 我做了,但后来发现要执行延迟,必须在InstallInitialize和IntallFinalize阶段之间执行CustomAction;这不是我需要的。

你好

我一直在使用WIX(Windows installer XML)技术为我们的产品构建安装程序。如果在安装后选中该复选框,则预期的行为是启动产品

这已经运行了一段时间了,但我们最近发现Win7的UAC和Vista正在阻止该应用程序的启动。我做了一些研究,有人建议我应该添加属性

执行class='deferred'并模拟class='no'

我做了,但后来发现要执行延迟,必须在InstallInitialize和IntallFinalize阶段之间执行CustomAction;这不是我需要的。如果选中了启动复选框,我需要在安装完成后启动产品。是否有其他方法提升权限


我们将感谢您提供的所有答案、建议或解决方案。

WiX工具集文档中有一个主题,名为“如何做到这一点”。

不幸的是,Rob提到的主题对Windows Vista或7没有帮助。尤其是在UAC开启的情况下

我解决这个问题的方法是使用CustomAction启动命令提示符并启动所需的应用程序

<CustomAction 
    Id="LaunchApp" 
    Directory="YourDirectory" 
    ExeCommand="[SystemFolder]cmd.exe /C app.exe" />

希望有帮助

Ray

查看如何运行整个msi

在GenerateBottrapper任务的帮助下,您可以在.wixproj文件中自动执行此操作。总结如下:

创建一个setup.manifest,如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="Setup" type="win32" />
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <!-- standard PropertyGroups and ItemGroups -->

 <PropertyGroup>
   <WindowsSDK>$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder)</WindowsSDK>
 </PropertyGroup>
 <PropertyGroup Condition="$(WindowsSDK) == ''">
   <WindowsSDK>$(registry:HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder)</WindowsSDK>
 </PropertyGroup>

 <PropertyGroup>
   <mt_exe>$(WindowsSDK)bin\mt.exe</mt_exe>
 </PropertyGroup>

 <ItemGroup>
   <BootstrapperFile Include="Microsoft.Windows.Installer.3.1" >
     <ProductName>Windows Installer 3.1</ProductName>
   </BootstrapperFile>
   <!-- more BootstrapperFile items -->
 </ItemGroup>

 <Target Name="Bootstrapper"
         Inputs="$(OutDir)$(TargetFileName)"
         Outputs="$(OutDir)\Setup.exe"
         Condition=" '$(OutputType)'=='package' " >
   <GenerateBootstrapper ApplicationName="application name"
                         ApplicationFile="$(TargetFileName)"
                         BootstrapperItems="@(BootstrapperFile)"
                         ComponentsLocation="Relative"
                         OutputPath="$(OutputPath)"
                         Culture="en-US"
                         Path="$(WindowsSDK)\Bootstrapper" />
 </Target>

 <Target Name="PatchSetupExe" DependsOnTargets="Bootstrapper">
   <Exec Command='"$(mt_exe)" -manifest setup.manifest -outputresource:$(OutDir)\Setup.exe;#1' IgnoreExitCode='false' />
 </Target>

 <Import Project="$(MSBuildExtensionsPath)\Microsoft\WiX\v3.0\Wix.targets" />

 <PropertyGroup>
   <BuildDependsOn>$(BuildDependsOn);Bootstrapper;PatchSetupExe</BuildDependsOn>
 </PropertyGroup>
</Project>

并按如下方式修改.wixproj文件:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="Setup" type="win32" />
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <!-- standard PropertyGroups and ItemGroups -->

 <PropertyGroup>
   <WindowsSDK>$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder)</WindowsSDK>
 </PropertyGroup>
 <PropertyGroup Condition="$(WindowsSDK) == ''">
   <WindowsSDK>$(registry:HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder)</WindowsSDK>
 </PropertyGroup>

 <PropertyGroup>
   <mt_exe>$(WindowsSDK)bin\mt.exe</mt_exe>
 </PropertyGroup>

 <ItemGroup>
   <BootstrapperFile Include="Microsoft.Windows.Installer.3.1" >
     <ProductName>Windows Installer 3.1</ProductName>
   </BootstrapperFile>
   <!-- more BootstrapperFile items -->
 </ItemGroup>

 <Target Name="Bootstrapper"
         Inputs="$(OutDir)$(TargetFileName)"
         Outputs="$(OutDir)\Setup.exe"
         Condition=" '$(OutputType)'=='package' " >
   <GenerateBootstrapper ApplicationName="application name"
                         ApplicationFile="$(TargetFileName)"
                         BootstrapperItems="@(BootstrapperFile)"
                         ComponentsLocation="Relative"
                         OutputPath="$(OutputPath)"
                         Culture="en-US"
                         Path="$(WindowsSDK)\Bootstrapper" />
 </Target>

 <Target Name="PatchSetupExe" DependsOnTargets="Bootstrapper">
   <Exec Command='"$(mt_exe)" -manifest setup.manifest -outputresource:$(OutDir)\Setup.exe;#1' IgnoreExitCode='false' />
 </Target>

 <Import Project="$(MSBuildExtensionsPath)\Microsoft\WiX\v3.0\Wix.targets" />

 <PropertyGroup>
   <BuildDependsOn>$(BuildDependsOn);Bootstrapper;PatchSetupExe</BuildDependsOn>
 </PropertyGroup>
</Project>

$(注册表:HKEY\U LOCAL\U MACHINE\SOFTWARE\Microsoft\Microsoft SDK)\Windows@CurrentInstallFolder)
$(注册表:HKEY\U CURRENT\U USER\SOFTWARE\Microsoft\Microsoft SDK)\Windows@CurrentInstallFolder)
$(WindowsSDK)bin\mt.exe
Windows安装程序3.1
$(BuildDependsOn);引导器;PatchSetupExe

现在,将在每个版本上生成一个正确的setup.exe,该setup.exe将运行提升版。

这篇文章没有解决OP关于提升权限的问题。