MSBuild and long file path

Hello.

If you have a problem with long file path while the compilation of project in Visual Studio, look at this trick that help me from time to time:

<DefineConstants>$(DefineConstants);V_SRC_ROOT_DIR__TESTS=$([System.IO.Path]::GetFullPath('$(IBP_RootDir)..\TestCode\'))</DefineConstants>

[System.IO.Path]::GetFullPath(‘…’) converts relative path into absolute and this operation can significantly reduce the final string of file path.

Every time when it helps me, I say ‘Hallelujah!’ 🙂

Leave a Comment