I am trying to use $(SolutionDir)
or $(SolutionPath)
in a .csproj
file in Visual Studio 2017 but they do not work as expected.
In an MSBuild 15 type project (e.g., .NET Core, .NET Standard class library), using $(SolutionDir)
in a <PostBuildEvent>
works, but $(ProjectDir)
just produces an empty string.
In other elements (e.g., AssemblyFile
in UsingTask
) $(SolutionDir)
produces an empty string and $(SolutionPath)
gives me the current project directory.
This has been reported to Microsoft at https://developercommunity.visualstudio.com/content/problem/11118/postbuild-event-and-macros-issues.html but the issue has been marked as Closed on the grounds that the problem was fixed in RTM, even though several people have reported having problems with the released version.