在安装程序完成时启动应用程序无法在用户模式下运行

时间:2019-06-04 16:24:39

标签: wix windows-installer

我正在创建一个带有复选框的双模式安装程序,以便用户在安装后启动应用程序。

在机器范围内安装(管理模式)时,应用程序将按预期启动。

仅为用户安装(非管理员模式)时,该应用无法启动:

Action ended 9:04:52: LaunchApplication. Return value 3.
MSI (c) (F0:94) [09:04:52:151]: Note: 1: 2205 2:  3: Error 
MSI (c) (F0:94) [09:04:52:151]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 2896 
DEBUG: Error 2896:  Executing action LaunchApplication failed.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: LaunchApplication, , 

我看过具有相同错误的this question,但是我已经在方括号中输入了文件名:

<Property Id="WixShellExecTarget" Value="[#FILE_SweetApp.WPF.exe]" />

有什么想法吗?


修改

这是相关代码:

<?define MyPath="$(var.SolutionDir)MyApp.WPF\bin\$(var.Configuration)"?>

<ComponentGroup Id="MyApp.WPF"  Directory="APPLICATIONFOLDER">
    <Component Id="MainExecutable" Guid="{my guid}">
        <File Id="FILE_App.WPF.exe" Source="$(var.MyPath)\myapp.exe" />
    </Component>
    ...
</ComponentGroup>

<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch app when setup exits." />
<Property Id="WixShellExecTarget" Value="[#FILE_App.WPF.exe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />

<UI>
  <Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT installed</Publish>
</UI>

2 个答案:

答案 0 :(得分:1)

  

最佳猜想 :如果不查看源代码,很难猜测出什么地方出了问题。我想说您可能在 library(shiny) library(shinydashboard) library(fmsb) library(graphics) require(radarchart) shinyUI(dashboardPage( dashboardHeader(title = "Working on it"), dashboardSidebar(), dashboardBody( box( title = "VALUES", sliderInput( "years", "Select Year:", min = min(df1$YEAR), max = max(df1$YEAR), value = c(min(df1$YEAR), max(df1$YEAR)), step = 1 ) ) ), fluidRow( chartJSRadarOutput('radarPlot' ) ) ) ) ) 属性值和要启动的文件的 WixShellExecTarget 之间存在不匹配的引用吗?:

File Id

WiX文档 :WiX文档中有一个示例:WiX sample for application launch(供其他人参考)。

模拟样本 :这是基于上述链接的样本。您必须首先: <..> <Property Id="WixShellExecTarget" Value="[#MyFile.exe]" /> <..> <File Id="MyFile.exe" Source="C:\MyFile.exe"> <..> 创建新的WiX 3项目, (1) 2) 添加引用,然后 WixUIExtension.dll

WixUtilExtension.dll

答案 1 :(得分:0)

问题在于#FILE_App.WPF.exe的值。

<Property Id="WixShellExecTarget" Value="[#FILE_App.WPF.exe]" />

对于全新的每位用户安装,该值为:

%userprofile%\AppData\Local\Programs\MySweetApp\MySweet.exe

代替实际安装位​​置:

%userprofile%\AppData\Local\Apps\MySweetApp\MySweet.exe

因此,LaunchApplication自定义操作无法找到.exe并失败。

解决方案是使用正确的.exe位置创建自定义属性(ExeLocation),并将其用于自定义操作:

<Property Id="WixShellExecTarget" Value="[ExeLocation]" />