$(MSBuildStartupDirectory) in Visual Studio points to different places on different machines

Posted by skolima on Stack Overflow See other posts from Stack Overflow or by skolima
Published on 2012-10-26T11:10:19Z Indexed on 2012/10/29 17:01 UTC
Read the original article Hit count: 254

Filed under:
|
|

In a large solution, I'm integrating Gendarme into Visual Studio 2008 compilation process. I am using GendarmeMsBuild task along with a .targets file to add a AfterBuild target to every project in the solution. I am looking for a way to import this file into .csproj files in a way that wouldn't require me to change the include path (the projects have different nesting levels). Apart from using NuGet SolutionDir variable, best way to solve this seemed to be to use $(MSBuildStartupDirectory). However, as it turns out, on some machines, using the same version of VS 2008 (as same updates installed, as far as I was able to check) this resolves to the solution directory, and on others to c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE.

How can I either

  • get this to always resolve to the solution folder
  • or obtain the base folder in another consistent way?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about visual-studio-2008