2014-11-07 6 views
2

내 응용 프로그램을 설치하는 부트 스트 래퍼 설치 프로그램과 내 응용 프로그램을 실행하는 데 필요한 하나의 타사 응용 프로그램을 만들려고합니다.Wix 번들 소스 경로 및 프로젝트 구조

타사 응용 프로그램은 많은 보완 파일이있는 .exe 패키지입니다.

내 질문은, 어떻게 내 번들에 타사 응용 프로그램을 포함시킬 수 있습니까? 모든 부수적 인 파일 (100 개 이상의 파일)을 페이로드로 추가해야합니까?

아래의 코드는 지금까지 내 번들을 어떻게 설정했는지, 컴파일하고 있지만 설치하고 있지 않은지, 로그에는 부트 스트 래퍼 .exe가 내 .msi (내 앱) 또는 .exe (세 번째 파티 앱)

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> 
    <Bundle Name="My_app" 
      Version="1.0.0.0" 
      Manufacturer="untitled" 
      UpgradeCode="4d2de235-2286-4b06-8cfa-3f6ff3174244"> 

     <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" /> 

     <Chain> 
      <MsiPackage 
       Id="MyApp_msi" 
       SourceFile ="MyApp\MyApp.msi" 
       Vital ="yes"/> 
      <PackageGroupRef Id="thirdParty_package" /> 
     </Chain> 
    </Bundle> 

    <Fragment> 
     <PackageGroup Id="thirdParty_package"> 
      <ExePackage 
       SourceFile="thirdParty\Setup.exe" 
       InstallCommand="/q /ACTION=Install" 
       RepairCommand="/q ACTION=Repair /hideconsole" 
       UninstallCommand="/q ACTION=Uninstall /hideconsole"/> 
     </PackageGroup> 
    </Fragment> 
</Wix> 
+0

당신이 참조하는 디렉토리 (MyApp와 thirdParty)는 설치 프로그램 프로젝트와 동일한 디렉토리에 있습니까? 당신의 작업 디렉토리가 당신이 생각하는 곳과 다른 것처럼 보입니다. (또는 그 파일들이 실제로 존재하지 않습니다.) –

+0

Mr WiX-Rob - 여기에 답변 : http : //windows-installer-xml-wix-toolset.687559.n2. nabble.com/Burn-ExePackage-that-depends-on-many-files-td7205293.html –

답변

2

네, 모든 페이로드를 나열해야합니다. PayloadGroup에 두는 것이 편리합니다.

PayloadGroup을 생성하는 데는 몇 가지 방법이 있습니다. 한 가지 방법은 디렉토리를 수집하기 위해 열을 사용/남용하는 것입니다. 이는 설치 프로젝트의 디렉토리를 수집하는 것과 같은 방식입니다.

예를 들어, WiX의 bin 디렉토리를 패키징하자. 당신은 MSBuild를 사용하는 경우 (비주얼 스튜디오 등을 통해)

<ExePackage Id="MyPackageId" SourceFile="$(env.WiX)bin/dark.exe" Compressed="yes"> 
    <PayloadGroupRef Id="MyPayloadGroupId"/> 
    </ExePackage> 

, 당신은 프로젝트 파일에 이런 식으로 뭔가를 추가하여 수확을 구성 할 수 있습니다

<ItemGroup> 
    <HarvestDirectory Include="$(WIX)/bin"> 
     <ComponentGroupName>MyPayloadGroupId</ComponentGroupName> 
     <PreprocessorVariable>var.MyPayloadSourceDirectory</PreprocessorVariable> 
     <Transforms>FilesToPayloads.xsl</Transforms> 
     <SuppressRegistry>true</SuppressRegistry> 
     <!-- Hide from VS Solution Explorer --> 
     <InProject>false</InProject> 
    </HarvestDirectory> 
    </ItemGroup> 

빌드가 출력을 추가 실행합니다. wsx (obj에서) 폴더를 빌드합니다. (볼 필요가 없습니다.)

원본 파일의 실제 위치를 알려주기 위해 전 처리기 변수를 사용합니다. 값을 전달하려면 프로젝트 특성에서 값을 정의하십시오. 또는, .wixproj에서 XML로 :

<DefineConstants>Debug;MyPayloadSourceDirectory=C:/Program Files (x86)/WiX Toolset v3.8/bin</DefineConstants> 

마지막으로, XSL 변환 (FilesToPayloads.xsl)는 그 열은 정상적인 수확 출력에 적용됩니다

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" 
    xmlns="http://schemas.microsoft.com/wix/2006/wi"> 

    <xsl:template match="/"> 
    <Wix> 
     <Fragment> 
     <xsl:apply-templates select="*" /> 
     </Fragment> 
    </Wix> 
    </xsl:template> 

    <xsl:template match="//wix:DirectoryRef"> 
    <PayloadGroup> 
     <xsl:attribute name="Id"> 
     <xsl:value-of select="/wix:Wix/wix:Fragment/wix:ComponentGroup/@Id"/> 
     </xsl:attribute> 
     <xsl:apply-templates select="*" /> 
    </PayloadGroup> 
    </xsl:template> 

    <xsl:template match="//wix:File"> 
    <Payload> 
     <xsl:attribute name="SourceFile"> 
     <xsl:value-of select="@Source"/> 
     </xsl:attribute> 
    </Payload> 
    </xsl:template> 

</xsl:stylesheet> 

그것은 파일의 오히려 사소한 음역이다 Payload와 그 주변 DirectoryRef를 PayloadGroup에 전달한다.

+0

이 해결책은 좋지 않습니다. 여기에 적절한 하나가 있습니다 https://stackoverflow.com/a/33834345/1614150 – Brun

0

동의어 많은 파일을 가진 설치 프로그램을 위해 수동으로 페이로드를 생성하는 것이 좋습니다. 여기에 경로가 주어진 페이로드 XML을 생성하는 작은 powershell 스크립트가 있습니다. 그것은 id로 사용할 guid를 생성하고, 폴더를 되풀이하며, 폴더 구조를 재생산합니다.

if($args.Length -eq 0) { 
    Write-Host "Error: No argument. Supply path to payload folder as script argument." 
    Exit 1 
} 
$path = $args[0] 
foreach($file in Get-ChildItem -Name $path -File -Recurse) 
{ 
    Write-Host ("<Payload Id=`"" + ([guid]::NewGuid()) + "`" SourceFile=`"" + (Join-Path -Path $path -ChildPath $file) + "`" Name=`"" + $file + "`" />") 
}