Is there a way to check if OutputPath
has been overwritten in a csproj?
#8113
Replies: 3 comments
-
I can't think of a really good way; I like your You could maybe try to compute if msbuild/src/Tasks/Microsoft.Common.CurrentVersion.targets Lines 154 to 156 in 3777dca But that sounds pretty fragile. |
Beta Was this translation helpful? Give feedback.
-
I hoped .NET SDK might provide a way to do this:
However it looks like .NET SDK does not recognise a property like that. There are other similar properties but SDK imports the referenced files too late. |
Beta Was this translation helpful? Give feedback.
-
Closing as currently there is no better solution. |
Beta Was this translation helpful? Give feedback.
-
I want to group most of my projects in a few output folders and I'm setting
OutputPath
inDirectory.Build.targets
using some simple conditions (e.g. test projects go toTestOutput
). I also have a few projects that I would like to exclude from these rules as they have a customOutputPath
already set in their.csproj
.I was wondering if there is a recommended way of checking if
OutputPath
was overwritten in a.csproj
. The only solution I found at the moment is to set a custom property instead ofOutputPath
in the.csproj
(e.g.CustomOutputPath
) and when that property is set, I use it instead of the generic rules I defined. Another variation of this would be just using that second property as a flag and keepingOutputPath
as it is.Is there a simpler/cleaner way of doing this? Ideally, I would like to be able to just add some kind of condition like `'($OutputPath)' != '($DefaultOutputPath)', but I don't think this exists (or at least I haven't found it yet).
Beta Was this translation helpful? Give feedback.
All reactions