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

前端 未结 5 1969
猫巷女王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 08:58

    Wasted a lot of time to find perfect solution for this problem. Use Directory.Build.props.

    In your sln location folder create a file with name Directory.Build.props and put this code inside:

    
     
        $(MSBuildThisFileDirectory)
     
    
    

    This file will be automagically picked up by all your csproj files and will define (SolutionDir) property.

提交回复
热议问题