title: Build MSI in Azure DevOps using Wix Toolkit
body: <p>I have a Visual Studio solution consisting of two projects; MyProject and MyProject.Installer where the latter is a Wix Toolset project. I do <strong>not</strong> reference MyProject from the Wix project because I do not want the typical build output, but rather the stand-alone binaries (see pipeline).</p>
  <p>I do a dotnet publish and output the files I want to \client relative to the MyProject.Installer wix project. In the Product.wxs file i reference these files:</p>
  <pre><code>&lt;Component Id=&quot;MyProject.exe&quot; Guid=&quot;b1211231-2e88-4679-b2d3-879e8a3f9353&quot;&gt;
      &lt;File Id=&quot;MyProject.exe&quot; Source=&quot;client\MyProject.exe&quot; KeyPath=&quot;yes&quot;  /&gt;
  &lt;/Component&gt;
  </code></pre>
  <p>My Azure DevOps pipeline is as follows:</p>
  <pre><code>trigger:
  - master
  
  pool:
    vmImage: 'windows-latest'
  variables:
    solution: '**/*.sln'
    buildPlatform: 'Any CPU'
    buildConfiguration: 'Release'
  steps:
  - task: NuGetCommand@2
    inputs:
      restoreSolution: '$(solution)'
  - task: DotNetCoreCLI@2
    inputs:
      command: 'publish'
      publishWebProjects: false
      projects: '**/MyProject.csproj'
      arguments: '--output $(Build.ArtifactStagingDirectory)\client --configuration $(BuildConfiguration) --runtime win-x86 -p:PublishSingleFile=true -p:PublishTrimmed=true'
      zipAfterPublish: false
      modifyOutputPath: false
  - task: MSBuild@1
    inputs:
      solution: '**/*.wixproj'
      configuration: '$(BuildConfiguration)'
      msbuildArguments: '/p:RunWixToolsOutOfProc=true'
  - task: PublishBuildArtifacts@1
    displayName: 'Save artifacts'
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: 'drop'
      publishLocation: 'Container'
  </code></pre>
  <p>Output from pipeline run (successful):</p>
  <pre><code>&quot;C:\Program Files\dotnet\dotnet.exe&quot; publish D:\a\1\s\MyProject\MyProject.csproj --output D:\a\1\a\client --configuration Release --runtime win-x86 -p:PublishSingleFile=true -p:PublishTrimmed=true
  </code></pre>
  <p>And WIX (unsuccessful):</p>
  <pre><code>C:\Program Files (x86)\WiX Toolset v3.11\bin\Light.exe -out D:\a\1\s\MyProject.Installer\bin\Release\nb-NO\MyProject.Installer.msi -pdbout D:\a\1\s\MyProject.Installer\bin\Release\nb-NO\MyProject.Installer.wixpdb -cultures:nb-NO -ext &quot;C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll&quot; -loc Product.nb-NO.wxl -contentsfile obj\Release\MyProject.Installer.wixproj.BindContentsFileListnb-NO.txt -outputsfile obj\Release\MyProject.Installer.wixproj.BindOutputsFileListnb-NO.txt -builtoutputsfile obj\Release\MyProject.Installer.wixproj.BindBuiltOutputsFileListnb-NO.txt -wixprojectfile D:\a\1\s\MyProject.Installer\MyProject.Installer.wixproj obj\Release\Product.wixobj
  ##[error]MyProject.Installer\Product.wxs(108,0): Error LGHT0103: The system cannot find the file 'client\MyProject.exe'.
  </code></pre>
  <p>It's clear that it cannot find the file to embed into the MSI, but I'm at a loss as to how to proceed.</p>
  <p>Any advice on how to organize the projects, the output and configuring the pipeline is much appreciated.</p>