安装后运行应用程序

时间:2020-06-11 06:43:21

标签: c# .net wix windows-installer exe

我有一个使用Wix工具集构建安装程序的.NET Core应用程序。

安装后我需要运行应用程序

这是我的wxs文件

 <?xml version="1.0" encoding="UTF-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

    <!--Define variables, etc -->
    <?if $(var.Platform)=x64?>
    <?define ProductCode = "{330C8B49-CEDF-467A-BB17-26282AFEC320}"?>
    <?else?>
    <?define ProductCode = "{5F408157-533F-4508-B131-F447FB2E1BFE}"?>
    <?endif?>

    <?define Version = "1.0.0.1"?>
    <?define UpgradeCode = "{FC5D3CBA-759A-4B62-B8DE-1697FACE1632}"?>

    <!--Provide Product Info -->
    <Product Id="$(var.ProductCode)"
             Name="!(loc.ProductName_$(var.Platform))"
             Language="!(loc.Language)"
             Version="$(var.Version)"
             Manufacturer="!(loc.ManufacturerName)"
             UpgradeCode="$(var.UpgradeCode)">


        <!--Provide Package Details -->
        <Package
            InstallerVersion="200"
            Compressed="yes"
            InstallScope="perMachine"
            Platform="$(var.Platform)"
            Manufacturer="!(loc.ManufacturerName)"
            Description="!(loc.Description)"
            Keywords="!(loc.Keywords)"
            Languages="!(loc.Language)" />

        <!--Upgrade stuff -->
        <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeMessage)" />

        <!--Media Template -->
        <MediaTemplate
            EmbedCab="yes" />

        <!--Icon -->

        <Icon Id="icon.ico" SourceFile="$(var.symphony-pc-adapter-netcore.ProjectDir)\AVISPL.ico" />

        <!--Use icon for installer -->
        <Property Id="APPPRODUCTICON">icon.ico</Property>
        <!--Website -->
        <Property Id="APPURLINFOABOUT">https://avispl.com/en/</Property>
        <Property Id="ComboBoxProperty" Value=":" />
        <Property Id="CBHTTP" Admin="yes" Value="s:" />
        <Property Id="CLOUD_CONNECTOR" Admin="yes" Value="172.31.254.95" />
        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER">
        </Property>
        <Property Id="FIND_URL" Value="http://172.31.254.95/symphony-commproxy/v1/monitoring/device/find" />
        <Property Id="DATA_URL" Value="http://172.31.254.95/symphony-commproxy/v1/monitoring/data" />
        <Property Id="WS_URL" Value="ws://172.31.254.95/symphony-commproxy/v1/messaging/websocket" />
        <Property Id="PASSWORD" />
        <Property Id="USER" />

        <UIRef Id="WixUI_InstallDir" />
        <UI>
            <UIRef Id="WixUI_InstallDir" />

            <Dialog Id="t1" Width="370" Height="270" Title="Customise">
                <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
                    <Publish Value="wwwqqq" Property="ComboBoxProperty1" />
                    <Publish Event="NewDialog" Value="InstallDirDlg" Order="10" />
                </Control>
                <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)">
                    <Publish Event="NewDialog" Value="WelcomeDlg" Order="10" />
                </Control>
                <Control Type="Text" Id="Findcaption" Width="223" Height="15" X="22" Y="30" Text="Symphony cloud connector address" />
                <Control Type="Edit" Id="ip_server" Width="114" Height="15" X="82" Y="52" Property="CLOUD_CONNECTOR" />
                <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Text="!(loc.WixUICancel)">
                    <Publish Event="SpawnDialog" Value="CancelDlg" Order="10" />
                </Control>
                <Control Type="ComboBox" Property="CBHTTP" Id="api_type" Width="50" Height="16" X="22" Y="52" ComboList="yes"
                         TabSkip="yes" Sunken="yes">
                    <ComboBox Property="CBHTTP">
                        <ListItem Text="http" Value=":" />
                        <ListItem Text="https" Value="s:" />
                    </ComboBox>
                </Control>
            </Dialog>
            <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
            <?define TRE1 = "[SERVER_IP]" ?>
            <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="t1" Order="2">1</Publish>
            <Publish Dialog="t1" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish>
            <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish>
        </UI>
        <WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)\Assets\UIBanner.bmp" />
        <WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Assets\UIDialog.bmp" />
        <!--Define components, shortcuts, etc -->
        <Feature Id="ProductFeature" Title="AV-SPL" Level="1">
            <ComponentGroupRef Id="PublishedComponents" />

        </Feature>
    </Product>
</Wix>

这是Directories.wxs,我尝试在其中添加运行.exe的代码

    <?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="!(loc.ProductNameFolder)" />
            </Directory>
        </Directory>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <Component Id="TargetProgram" Guid="f757ff43-0266-483a-8749-ec796cba4b25" >
                <File Id="EXE" Source="C:\Program Files (x86)\AV-SPL Service\symphony-pc-adapter-netcore.exe" />
            </Component>
        </ComponentGroup>

        <CustomAction Id="EXECUTE_AFTER_FINALIZE"
                      Execute="immediate"
                      Impersonate="no"
                      Return="asyncNoWait"
                      FileKey="EXE"
                      ExeCommand="" />

        <InstallExecuteSequence>
            <Custom Action="EXECUTE_AFTER_FINALIZE" After="InstallFinalize">NOT Installed</Custom>
        </InstallExecuteSequence>
    </Fragment>
</Wix>

一切正常,已安装应用程序,但未运行。

我的问题在哪里?

0 个答案:

没有答案