GenesysStack.com

Did you know that $(MSBuildProjectDirectory) will work, even when $(ProjectDir) is blank?

Since $(ProjectDir) is not available until after Microsoft.Common.Targets is imported, it may be blank in some cases.

Use $(MSBuildProjectDirectory) instead of $(ProjectDir), as it contains your project directory path from MSBuild itself.

Our HTM+JS projects reside in Visual Studio 2017 Empty Web App projects, so they build & deploy identically to our heavy-duty MVC and Web API projects.

But as HTML+JS apps, we removed nearly all references and the web.config file. In this configuration, $(ProjectDir) is blank at Pre-build event time, $(MSBuildProjectDirectory) works.

Leave your comment