Как включить папку веб-приложения в MSI

Я пытаюсь выполнить настройку веб-приложения с VS2010 и WIX, он работает нормально, но единственное, что я хочу улучшить, - это когда вы создаете проект установки, он помещает выходные данные веб-приложения в отдельную папку внутри папки bin, поэтому если я хочу установить эту сеть на сервере, мне нужно скопировать файл msi + папку веб-приложения.

Есть ли способ создать проект установки, чтобы включить эту папку в пакет msi?

Вот мой файл .wixproj:

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


<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
      <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
      <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
      <ProductVersion>3.7</ProductVersion>
      <ProjectGuid>{7bc848bd-4069-429e-847e-4f964a148362}</ProjectGuid>
      <SchemaVersion>2.0</SchemaVersion>
      <OutputName>Tgw.WebClient.Goodyear.Setup</OutputName>
      <OutputType>Package</OutputType>
      <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
      <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
      <SccProjectName>SAK</SccProjectName>
      <SccProvider>SAK</SccProvider>
      <SccAuxPath>SAK</SccAuxPath>
      <SccLocalPath>SAK</SccLocalPath>
    </PropertyGroup>
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
      <OutputPath>bin\$(Configuration)\</OutputPath>
      <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
      <DefineConstants>Debug</DefineConstants>
    </PropertyGroup>
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
      <OutputPath>bin\$(Configuration)\</OutputPath>
      <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    </PropertyGroup>
    <ItemGroup>
      <Compile Include="MainConfiguration.wxs" />
      <Compile Include="Tgw.WebClient.Standalone.Web.wxs" />
      <Compile Include="WIXUI_Screens.wxs" />
    </ItemGroup>
    <ItemGroup>
      <EmbeddedResource Include="Resources\Strings.wxl" />
    </ItemGroup>
    <ItemGroup>
      <ProjectReference Include="..\..\Standalone\Source\Tgw.WebClient.Standalone.Web\Tgw.WebClient.Standalone.Web.csproj">
        <Name>Tgw.WebClient.Standalone.Web</Name>
        <Project>{f50a4ff0-6878-4a27-bce7-4956d1ae27db}</Project>
        <Private>True</Private>
        <DoNotHarvest>True</DoNotHarvest>
        <RefProjectOutputGroups>
        </RefProjectOutputGroups>
        <RefTargetDir>TARGETINSTALLDIRECTORY</RefTargetDir>
        <WebProject>True</WebProject>
      </ProjectReference>
    </ItemGroup>
    <ItemGroup>
      <WixExtension Include="WixNetFxExtension">
        <HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
        <Name>WixNetFxExtension</Name>
      </WixExtension>
      <WixExtension Include="WixIIsExtension">
        <HintPath>$(WixExtDir)\WixIIsExtension.dll</HintPath>
        <Name>WixIIsExtension</Name>
      </WixExtension>
      <WixExtension Include="WixUtilExtension">
        <HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
        <Name>WixUtilExtension</Name>
      </WixExtension>
      <WixExtension Include="WixUIExtension">
        <HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
        <Name>WixUIExtension</Name>
      </WixExtension>
    </ItemGroup>
    <ItemGroup>
      <Content Include="Configuration\Conditions.wxi" />
      <Content Include="Configuration\Settings.wxi" />
      <Content Include="Resources\CommanderApp_32.ico" />
      <Content Include="Scripts\CreateWebApplicationConfigFiles.ps1" />
    </ItemGroup>
    <ItemGroup>
      <Folder Include="Configuration" />
      <Folder Include="Scripts" />
      <Folder Include="Resources" />
    </ItemGroup>
    <Import Project="$(WixTargetsPath)" />
    <!--
      To modify your build process, add your task inside one of the targets below and uncomment it.
      Other similar extension points exist, see Wix.targets.-->
    <Import Project="$(WixTargetsPath)" />
    <Target Name="BeforeBuild">
      <MSBuild Projects="%(ProjectReference.FullPath)" Targets="Package" Properties="Configuration=$(Configuration);Platform=AnyCPU" Condition="'%(ProjectReference.WebProject)'=='True'" />
      <PropertyGroup>
        <LinkerBaseInputPaths>%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\</LinkerBaseInputPaths>
        <DefineConstants>BasePath=%(ProjectReference.RootDir)%(ProjectReference.Directory);</DefineConstants>
      </PropertyGroup>
      <HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" DirectoryRefId="TARGETINSTALLDIRECTORY" ComponentGroupName="%(ProjectReference.Filename)_Project" AutogenerateGuids="true" SuppressCom="true" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" ToolPath="$(WixToolPath)" Condition="'%(ProjectReference.WebProject)'=='True'" PreprocessorVariable="var.BasePath" />
    </Target>
  </Project>

И это часть моего автоматически сгенерированного .wsx:

  <?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="TARGETINSTALLDIRECTORY">
            <Component Id="cmp975763C4E1B3C939E4CD1957234F6BAC" Guid="*">
                <File Id="filAB034261C737C6286CB0722DB3566B4F" KeyPath="yes" Source="$(var.BasePath)\About.aspx" />
            </Component>
            <Component Id="cmp0ADE3CAB02CA0E4E0C08810D00C09DEB" Guid="*">
                <File Id="fil2CF0D37E848154468D37906E1D0B2FB8" KeyPath="yes" Source="$(var.BasePath)\AspWebStart.aspx" />
            </Component>            
            </Directory>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="Tgw.WebClient.Standalone.Web_Project">
            <ComponentRef Id="cmp975763C4E1B3C939E4CD1957234F6BAC" />
            <ComponentRef Id="cmp0ADE3CAB02CA0E4E0C08810D00C09DEB" />               
        </ComponentGroup>
    </Fragment>
</Wix>

person Javier Hertfelder    schedule 17.01.2013    source источник


Ответы (1)


Не видя содержимого файла Tgw.WebClient.Standalone.Web.wxs, я не могу сказать наверняка, но это наиболее вероятный ответ на ваш вопрос! :)

Если вы имеете в виду файлы содержимого веб-приложения, такие как html, cshtml, aspx, jpg и т. Д., У вас есть несколько вариантов.

Вручную включите все файлы в ваши файлы .wxs как компоненты:

<Component>
    <File Id="ContentFile1"
          Name="index.html"
          Source="$(var.Tgw.WebClient.Standalone.Web.ProjectDir)\index.html" />
</Component>

очевидно, что это займет довольно много времени, если у вас большой веб-сайт.

Используйте инструмент командной строки heat, чтобы собрать все ваши файлы содержимого и создать файлы .wxs. для вас, который затем можно статически включить. Это имеет то преимущество, что вы можете быстро создавать вышеуказанные компоненты, но легко настраивать их.

Наконец, вы можете отредактировать файл wixproj и включить элемент HeatDirectory. Затем это будет собирать ваш контент при каждой сборке, поэтому любой новый файл будет автоматически включен. При необходимости вы также можете изменить этот вывод с помощью xslt.

person caveman_dick    schedule 18.01.2013
comment
Спасибо за ваш ответ. Я слежу за этим сообщением, чтобы автоматически собрать все файлы: paraesthesia.com/archive/2010/07/30/ - person Javier Hertfelder; 19.01.2013