使用WiX工具集部署WCF Web服务 - 步骤

时间:2016-06-16 08:16:10

标签: asp.net wcf wix wix3.8

我正在构建一个WCF服务项目,现在我想在解决方案中添加一个基于Wix的安装项目(VS.NET 2013)。我是第一次使用Wix工具集。我使用的是最新版本的Wix工具集Ver 3.10。

请帮我解决填写.wxs文件所需的步骤。

Solution structure in vs.net 2013

WCF Service Structure

以下是ImportService.wxs中的xml内容: -

 <?xml version="1.0" encoding="UTF-8"?><Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="$(var.outputName)" Language="1033" Version="1.0.0.0" Manufacturer="Client" UpgradeCode="80d51001-e699-47b8-9221-fc6633fddf15">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />
    <MajorUpgrade DowngradeErrorMessage="A newer version of Import Service is already installed." />
<Media Id="1" Cabinet="Cab1.cab" EmbedCab="yes"/>
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="$(var.outputName)" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFiles64Folder">
    <Directory Id="Client" Name="Client" >
            <Directory Id="INSTALLFOLDER" Name="$(var.outputName)" />
    </Directory>   
        </Directory>
    </Directory>
</Fragment>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
        <!--<Component Id="ProductComponent" Guid="93A6A063-F63D-455A-BD63-A21D32D15CE5" Win64="yes">      

  </Component>-->
    </ComponentGroup>
</Fragment>

请建议如何添加WCF .svc&amp;其他文件进入wix文件中的ComponentGroup区域。

1 个答案:

答案 0 :(得分:0)

您可以使用IIS进行公共服务。

<!-- Use DISM to setup IIS (see also http://support.microsoft.com/kb/2736284) -->
    <!-- Build path to dism.exe (full path is important, just calling dism.exe without path will fail) -->
    <CustomAction Id="InstallIISSetProperty" Property="InstallIIS" Execute="immediate"
                                    Value="&quot;[System64Folder]dism.exe&quot; /Online /Enable-Feature /All /FeatureName:IIS-WebServerRole /FeatureName:IIS-ASPNET45 /FeatureName:IIS-ManagementConsole /FeatureName:IIS-ISAPIFilter /FeatureName:IIS-NetFxExtensibility45 /FeatureName:NetFx4Extended-ASPNET45" />
    <!-- Call dism.exe quietly (without showing command prompt).
                 (see also http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html) -->
    <CustomAction Id="InstallIIS" BinaryKey="WixCA" DllEntry="CAQuietExec64"
                    Execute="deferred" HideTarget="no" Return="ignore" Impersonate="no"/>

...

<InstallExecuteSequence>

 <Custom Action="InstallIISSetProperty" After="CostFinalize">
        <![CDATA[NOT Installed]]>
      </Custom>
      <Custom Action="InstallIIS" Before="WriteRegistryValues">
        <![CDATA[NOT Installed]]>
      </Custom>

</InstallExecuteSequence>