Prebuild event in Visual Studio replacing $(SolutionDir) with *Undefined*

前端 未结 5 1968
猫巷女王i
猫巷女王i 2020-12-17 08:31

I believe the problem is documented here moved here and looks like it might be a bug in visual studio, but I\'m wondering if anyone knows of a workaround.

5条回答
  •  抹茶落季
    2020-12-17 09:05

    Allan's answer is exactly on the right path, but if you want to move to parent directory of the ProjectDir, or the $(ProjectDir)..\ output is going to be a string, you need to perform the 'go to parent directory' operation in msbuild.
    Here is how you can achieve this:

    
      $([System.IO.Path]::GetDirectoryName($(ProjectDir)))
    
    

    This code will set the parent directory path of the ProjectDir to TrimmedDir variable. [System.IO.Path]::GetDirectoryName() performs this operation.

提交回复
热议问题