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.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to group most of my projects in a few output folders and I'm setting
OutputPathinDirectory.Build.targetsusing 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 customOutputPathalready set in their.csproj.I was wondering if there is a recommended way of checking if
OutputPathwas overwritten in a.csproj. The only solution I found at the moment is to set a custom property instead ofOutputPathin 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 keepingOutputPathas 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