$(SolutionDir) MSBuild property incorrect when running Sandcastle Help File Builder via CMD

前端 未结 2 1348
[愿得一人]
[愿得一人] 2021-01-03 22:56

When I run the Sandcastle Help File Builder project file (for example, myproject.shfbproj) using Windows CMD, I get an annoying issue: $(SolutionDir)

2条回答
  •  执念已碎
    2021-01-03 23:13

    While @m0sa has pointed out a very obvious fact (since I'm building the Sandcastle Help File Builder project, there's no actual solution directory), the issue was also happening during a TFS Build when building the solution where the so-called documentation project resides.

    For now I've managed to solve the issue using a nasty workaround: adding a SolutionDir property in each C# project that needs to be built as part of documentation project:

      
        $([System.IO.Path]::GetDirectoryName($(MSBuildProjectDirectory)))\
      
    

    Since my solution file will always be located in the parent directory of Sandcastle Help File Builder project directory, in my case this workaround works...

    Now referenced projects as documentation sources are able to import a custom project where I define common MSBuild properties, both in Visual Studio builds or external ones:

    
    

提交回复
热议问题