try-convert icon indicating copy to clipboard operation
try-convert copied to clipboard

PostBuildEvents and PreBuildEvents are not handled correctly today

Open jmarolf opened this issue 4 years ago • 1 comments

in the old project system you could define a PostBuildEvent like so

  <PropertyGroup>
    <PostBuildEvent>if exist "$(DevEnvDir)..\..\VC\Auxiliary\Build\vsvars32.bat" (
   call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vsvars32.bat"
   editbin /largeaddressaware "$(TargetPath)"
)</PostBuildEvent>
  </PropertyGroup>

And all the environment variables would be guaranteed to be defined. In the new project format, because of the order of implicit imports, you need to define a target to ensure backwards-compatible behavior. This is the equivalent functionality in the new format:

  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="if exist &quot;$(DevEnvDir)..\..\VC\Auxiliary\Build\vsvars32.bat&quot; (&#xD;&#xA;   call &quot;$(DevEnvDir)..\..\VC\Auxiliary\Build\vsvars32.bat&quot;&#xD;&#xA;   editbin /largeaddressaware &quot;$(TargetPath)&quot;&#xD;&#xA;)" />
  </Target>

NOTE: The project property pages already handle this if a user adds something but if they just run try-convert their PostBuild and PreBuild events may not work correctly

jmarolf avatar Mar 31 '20 17:03 jmarolf

Took me quit some time to figure this out. Thanks alot for the bug entry...

dos-ise avatar Jul 03 '20 05:07 dos-ise