Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrapper project cannot find MSI when OutputName is set in BeforeBuild target #4555

Closed
wixbot opened this issue Oct 13, 2014 · 1 comment
Milestone

Comments

@wixbot
Copy link

wixbot commented Oct 13, 2014

In My WIX Setup project I have a BeforeBuild target that updates the MSI output filename:

<Target Name="BeforeBuild" Condition=" '$(Configuration)' == 'Release' ">
    <GetAssemblyIdentity AssemblyFiles="$(OutDir)\MyCompany.MyApp.exe">
      <Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
    </GetAssemblyIdentity>
    <CreateProperty Value="$(OutputName).%(AssemblyVersion.Version).$(Platform)">
      <Output TaskParameter="Value" PropertyName="TargetName" />
    </CreateProperty>
    <CreateProperty Value="$(TargetName)$(TargetExt)">
      <Output TaskParameter="Value" PropertyName="TargetFileName" />
    </CreateProperty>
    <CreateProperty Value="$(TargetDir)$(TargetFileName)">
      <Output TaskParameter="Value" PropertyName="TargetPath" />
    </CreateProperty>
</Target>

And this is the reference in the Bootstrapper project:

<ItemGroup>
    <ProjectReference Include="..\Setup\Setup.wixproj">
      <Name>Setup</Name>
      <Project>{SOME-GUID}</Project>
      <Private>True</Private>
      <DoNotHarvest>True</DoNotHarvest>
      <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
      <RefTargetDir>INSTALLFOLDER</RefTargetDir>
    </ProjectReference>
  </ItemGroup>

When I reference this Setup project in my WIX Bootstrapper project, it says it cannot find "[OriginalFilename].msi" (LGHT0103). This is a major problem for me, since I really need the MSI filename to have the correct version number (which should be a common scenario). I encounter this error when using automated build with MSBuild. Not sure if it applies to Visual Studio.

I can see in the build log that candle.exe sets "-dSetup.TargetFileName" to the original filename.

Sure looks like a bug to me. Any chances for a fix?

Originally opened by znakeeye

@wixbot
Copy link
Author

wixbot commented Oct 13, 2014

This is actually a limitation of using the BeforeBuild target in MSBuild. When a ProjectReference is resolved it gets the target name by calling the GetTargetName target. The BeforeBuild target is not included in the dependencies of GetTargetName.

If you want to modify the name of the MSI in the build, you'll need to find a way to insert a target in the dependencies of GetTargetName.

Alternatively, you could just name the MSI differently in the Bundle by providing a Name attribute.

Finally, modifying the MSI package name will require a major upgrade so changing the MSI package name is not generally recommended.

Originally posted by robmen
Resolution set to by-design
Status changed from Untriaged to Resolved

@wixbot wixbot added this to the v3.8 milestone Dec 20, 2015
@wixbot wixbot closed this as completed Dec 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant