Have a .NET Core app that I'm trying to use $(ProjectDir) with and when I attempt to pass in that macro, I get an empty value. I tried what was suggested in Issue 26748846, but that didn't seem to solve my issue.
This happens because in .NET Core projects, the pre- and post build macros are set too early and the $(ProjectDir)
property is not yet available. Note that pre- and post build macros are deprecated and should be replaced by proper targets (see https://github.com/dotnet/project-system/issues/1569).
A quick fix would be to replace $(ProjectDir)
with $(MSBuildProjectDirectory)\
.