c00000fd
c00000fd

Reputation: 22265

$(TargetPath) for WiX project is incorrect for the post-build event

I'm using $(TargetPath) for post-build event for my WiX installer, that is built under VS 2022, and it is translated to:

C:\projects\My project\Installer\installer.msi

when the .MSI file is created in:

C:\projects\My project\Installer\en-us\installer.msi

What is wrong there?

Upvotes: 0

Views: 479

Answers (1)

scaler
scaler

Reputation: 564

The PostBuildEvent property is evaluated before any targets are executed. In your case the initial value of $(TargetPath) is expanded before the wix target is called and changes it's value. Moving your post build commands to an AfterBuild target in your csproj file will solve this issue.

  <Target Name="AfterBuild">
    <Exec Command="echo $(TargetPath)" />
  </Target>

Upvotes: 0

Related Questions