如何使用WiX创建安装项目以安装两个Visual Studio扩展

时间:2014-01-07 21:45:46

标签: visual-studio wix visual-studio-extensions vsix visual-studio-setup-proje

我需要使用WiX创建一个安装项目来部署两个Visual Studio Extensions(vsix)。我按照您在此博客中可以看到的步骤创建项目:Creating WiX setup for VSIX。我可以编译项目并生成.msi文件,但是当我要安装扩展时,它给了我一个运行时错误,错误代码是2343。 WiX项目的XML是这样的:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:VSExtension="http://schemas.microsoft.com/wix/VSExtension"  xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
    <Product Id="{77F7DB1E-6E8A-44DB-88FE-9E496B140A2C}" Name="Bpmn Studio" Language="1033" Version="1.0.0.0" Manufacturer="Cadic" UpgradeCode="8c57d4aa-2b56-4561-94dd-cf02b34a4747">
        <Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate EmbedCab="yes" VolumeLabel="Bpmn Studio"/>

        <PropertyRef Id="VS2013DEVENV"/>
        <Condition Message="Visual Studio 2013 needs to be intalled for this installation to continue.">
            <![CDATA[Installed OR VS2013DEVENV]]>
        </Condition>

        <!--Directory structure-->
        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
        <UIRef Id="WixUI_InstallDir" />
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="Casasoft" >
                </Directory>
            </Directory>
        </Directory>

        <Property Id="VSINSTALLDIR">
            <RegistrySearch Id="VSInstallRegistry" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\12.0" Name="InstallDir" Type="directory" />
        </Property>

        <CustomAction Id="SetVSIXInstaller" Return="check" Execute="immediate" Property="VSIXInstaller" Value="C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\VSIXInstaller.exe" />
        <CustomAction Id="DeployVSIX" Property="VSIXInstaller" Execute="deferred" Impersonate="no" ExeCommand="/quiet" Return="asyncWait"/>

        <InstallExecuteSequence>
            <Custom Action="DeployVSIX" After="MsiPublishAssemblies" />
        </InstallExecuteSequence>

        <Feature Id="BpmnStudio" Title="Bpmn Studio" Level="1">
            <ComponentRef Id="BpmnStudioExtensionVSPackage" />
        </Feature>

        <Feature Id="ProjectTypeFeature" Title="Bpmn Studio Project Type" Level="1">
            <ComponentRef Id="VSProjectTypePackage" />
        </Feature>

    </Product>

    <Fragment>
        <ComponentGroup Id="VSProjectTypeProductComponents" Directory="INSTALLFOLDER">
            <Component Id="VSProjectTypePackage" Guid="BD8BA9C9-3728-4847-8428-EBECE32F79DA">
                <VSExtension:VsixPackage File="VsBpmnStudioProjectTypeInstaller" PackageId="86e54529-745f-4b71-85f2-d2eb602bb777" Target="professional" TargetVersion="12.0" Vital="yes" Permanent="yes" />
                <File Id="VsBpmnStudioProjectTypeInstaller" Name="BpmnStudioProject.vsix" Source="D:\Work\DSL\2013\Bpmn Studio\Common\Setup\BpmnStudioProject\bin\Debug\BpmnStudioProject.vsix" />
            </Component>
        </ComponentGroup>   
    </Fragment>

    <Fragment>
        <ComponentGroup Id="BpmnStudioExtension" Directory="INSTALLFOLDER">
            <Component Id="BpmnStudioExtensionVSPackage" Guid="BD8BA9C9-3728-4847-8429-EBECE32F79DA">
                <VSExtension:VsixPackage File="VsPackageInstaller" PackageId="86e54529-745f-4b71-85f2-d2eb602bb767" Target="professional" TargetVersion="12.0" Vital="yes" Permanent="yes" />
                <File Id="VsPackageInstaller" Name="CasaSoft.BpmnStudio.DslPackage.vsix" Source="D:\Work\DSL\2013\Bpmn Studio\DslPackage\bin\Debug\CasaSoft.BpmnStudio.DslPackage.vsix" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

1 个答案:

答案 0 :(得分:0)

嗨Jason:我找到了空路径,是在我设置我想在UI界面中安装扩展的路径时。值INSTALLALLOCATION不存在。我为INSTALLFOLDER更改此值,现在可以按我的方式工作