wixtoolset / issues

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

Value containing !(wix) variable is used before being resolved #5432

Open mediawolf opened 7 years ago

mediawolf commented 7 years ago

WIX 3.10.3.3007

In my bundled installer, I have a fragment that defines a shared package:

    <WixVariable Id="SharedProductInstallerPath"
                 Value="\\NetworkShare\SharedProduct.msi"
                 Overridable="yes"
                 />
    <PackageGroup Id="SharedProduct">
        <MsiPackage SourceFile="!(wix.SharedProductInstallerPath)"
                    DisplayInternalUI="no"
                    Compressed="yes"
                    Cache="no"
                    Vital="yes"
                    Permanent="yes"
                    Visible="yes"
                    />
    </PackageGroup>

Installer builds successfully but it installation fails and log contains this entry: [0F70:0808][2016-11-02T11:34:07]e000: Error 0x8007052e: Failed to open payload at path: \NetworkShare\SharedProduct.msi

BootstrapperApplicationData.xml contains this line:

I've looked at how WIX forms Name value if it's unspecified in wix3-develop\src\tools\wix\Compiler.cs: private void CreatePayloadRow(...) ... row[1] = String.IsNullOrEmpty(name) ? Path.GetFileName(sourceFile) : name ... Obviously Path.GetFileName() assumes that unexpanded !(wix.SharedProductInstallerPath) represents a file name. Workaround is to specify Name attribute explicitly which is a bit inconvenient and took time to figure out.

It would be nice if either:

  • (best) if unspecified values are automatically generated only after !(wix) variables are resolved
  • if compiler emits error (good) or warning (can be unnoticed) in cases, when value has to be automatically generated from other values containing unresolved variables
glen-nicol commented 7 years ago

I am having similar trouble to this issue. I am trying to put the package version into the name and url of an msipackage in my burn bundle so that different versions have unique file names. I have tried various forms of !(bind.packageVersion.$(var.PackageId)). I have tried it directly in the Name attribute. I have tried it through an intermediate preprocessor(which I get is the same). I have tried putting it into a WixVariable like so:

<WixVariable Id="PackageVersion" Value="!(bind.packageVersion.$(var.PackageId))" />

and then referencing that via !(wix.PackageVersion). Nothing seems to resolve correctly. I end up with a file that looks like this:

!(bind.packageVersion.PackageProjectName)PackageProjectName.msi.

However I know I have !(bind.packageVersion.$(var.PackageId)) correct because that works in the Bundle version attribute.

My MsiPackage has an ID as follows:

<MsiPackage Id="$(var.PackageId)"
     Name="!(bind.packageVersion.$(var.PackageId))_$(var.PackageProject.TargetFileName)"
    .../>

I am using Wix 3.11 Is this not supported or is there something I am missing?