wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
129 stars 36 forks source link

Culture-specific `TargetPath` preprocessor variable no longer works in WiX v4 #7590

Open doomlaur opened 1 year ago

doomlaur commented 1 year ago

4.0.1

Visual Studio Enterprise 2022 17.6.4

HeatWave for VS2022 1.0.1

7.0.304

(not relevant - issue happens at build time)

According to the WiX v3 documentation, it is possible to use a preprocessor variable like $(var.MyProject.en-US.TargetPath) to get the path to the localized build of a project. The same should be possible with WiX v4 according to the WiX v4 documentation.

However, I tried to migrate a WiX v3 project to v4 and started getting errors (more about that in a moment). The background: I have a project that creates an MSI and then uses a bundle to install the MSI and some other dependencies. Because for special requests we might still deliver an MSI without dependencies, we still offer the possibility to install using the standalone MSI, which also includes building it for both English (en-US) and German (de-DE). However, for most cases, we will simply deliver the bundle which does not show the UI of the MSI, so the language does not matter. Because of these reasons, our solution builds both English and German MSIs, then builds a bundle that uses the English version of the MSI. For that reason we're using the following in our bundle: <MsiPackage SourceFile="$(WixV4Test.en-US.TargetPath)">

To avoid unnecessary details I will explain the actual error using a new project:

  1. I created a new WiX v4 solution that contains an MSI project and a bundle.
  2. In addition to the already existing Package.en-us.wxl I added Package.de-de.wxl with Culture="de-DE".
  3. In the Bundle I used the following configuration:
    
    <Chain>
    <MsiPackage SourceFile="$(WixV4Test.TargetPath)" Id="WixV4TestID" Vital="yes" Compressed="yes" Cache="keep">


> 4. As expected, that did not work and produced the following error message: `>C:\PROJECTS\WixV4Test\Bundle\Bundle.wxs(8): error WIX0103: Cannot find the WixBundlePayload file 'C:\PROJECTS\WixV4Test\WixV4Test\bin\x64\Debug\de-DE\WixV4Test.msi;C:\PROJECTS\WixV4Test\WixV4Test\bin\x64\Debug\en-US\WixV4Test.msi'. The following paths were checked: C:\PROJECTS\WixV4Test\WixV4Test\bin\x64\Debug\de-DE\WixV4Test.msi;C:\PROJECTS\WixV4Test\WixV4Test\bin\x64\Debug\en-US\WixV4Test.msi`
> 5. I then tried to change the preprocessor variable for `SourceFile` to `$(WixV4Test.en-US.TargetPath)`. However, that produces the following error message: `>C:\PROJECTS\WixV4Test\Bundle\Bundle.wxs(8): error WIX0150: Undefined preprocessor variable '$(WixV4Test.en-US.TargetPath)'.`

* Describe the behavior you expected and how it differed from the actual behavior.

> The culture-specific `TargetPath` should work in WiX v4 just as it did with WiX v3.
doomlaur commented 1 year ago

Just in case anyone else has the same issue, here is a simple workaround until this issue is fixed: $(WixV4Test.TargetDir)\en-US\$(WixV4Test.TargetFileName)

Ebola-Chan-bot commented 6 months ago

I don't even have TargetDir. I wonder if it's the same problem.