Closed oold closed 9 months ago
Is this going to be fixed in Heatwave? For VS SDK projects VS authors a PostBuild target with an Exec. However Heatwave is authoring a PostBuildEvent property and it's not formatting MSBuild variables correctly.
We can reproduce this internally. We expect this issue to be fixed in the next HeatWave release.
@FireGiantHelp is there a timeframe for the next release. This issue is a bit of a show stopper right now. Thanks.
You can apply the fix by hand now. Open the .wixproj, remove the PreBuildEvent
property, and add a PreBuild
target:
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="echo $(ProjectDir)" />
</Target>
HeatWave will do the same when we publish the next release based on our customers' needs.
@FireGiantHelp Ok thanks I will try that. If I need to perform multiple commands do I need to create multiple
@FireGiantHelp your suggestion doesn't seem to work. Can you confirm the examples below were what you suggested should be used to fix the issue ? Thanks
This does not seem to work - it complains about Target being undefined
<Project Sdk="WixToolset.Sdk/4.0.3">
<PropertyGroup>
<Target Name="PostBuild" BeforeTargets="PostBuildEvent">
<Exec Command="echo $(ProjectDir)" />
<Exec Command="echo $(BuiltOuputPath)" />
<Exec Command="set version=1.2.189" />
<Exec Command="xcopy $(BuiltOuputPath) $(ProjectDir)Deployment\" />
<Exec Command="del $(ProjectDir)Deployment\XXXInstallerv%version%.msi" />
<Exec Command="rename $(ProjectDir)Deployment\XXXInstaller.msi XXXInstallerv%version%.msi" />
<Exec Command="$(ProjectDir)signer.bat $(ProjectDir)Deployment\" />
</Target>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\XXX\XXX.csproj" />
</ItemGroup>
</Project>
Moving Target outside of the PropertyGroup appears to run the commands now but the variables are still undefined
<Project Sdk="WixToolset.Sdk/4.0.3">
<PropertyGroup>
</PropertyGroup>
<Target Name="PostBuild" BeforeTargets="PostBuildEvent">
<Exec Command="echo $(ProjectDir)" />
<Exec Command="echo $(BuiltOuputPath)" />
<Exec Command="set version=1.2.189" />
<Exec Command="xcopy $(BuiltOuputPath) $(ProjectDir)Deployment\" />
<Exec Command="del $(ProjectDir)Deployment\XXXInstallerv%version%.msi" />
<Exec Command="rename $(ProjectDir)Deployment\XXXInstaller.msi XXXInstallerv%version%.msi" />
<Exec Command="$(ProjectDir)signer.bat $(ProjectDir)Deployment\" />
</Target>
<ItemGroup>
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\XXX\XXX.csproj" />
</ItemGroup>
</Project>
Your first Target
definition is incorrect MSBuild syntax. A Target
does not go inside a PropertyGroup
.
Your second attempt should probably use AfterTargets="PostBuildEvent"
instead of BeforeTargets=...
.
Thanks I will try that
Ok this seems to be working now. However is there any way to get the version number from the main assembly - or any way to define a variable and pass that along. With the usual post build events you can define environment variables such as the example shown below 'variable'
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="echo ProjectDir: $(ProjectDir)" />
<Exec Command="echo TargetPath: $(TargetPath)" />
<Exec Command="set version=1.2.189" />
<Exec Command="echo version: %version%" />
</Target>
We'll go ahead and close this case out now, as I believe we have addressed the issue at hand as it relates to HeatWave. At this point, your questions relate to MSBuild itself and the Microsoft common targets.
HeatWave Version
1.0.1.1
Visual Studio Version
16.11.30
Repro Steps
Previously reported and closed in #6. As noted, the issue still occurs.
Actual Result
Output:
Expected Result
Output: