Skip to content

Is there a way to check if OutputPath has been overwritten in a csproj? #8112

@thecristidima

Description

@thecristidima

I want to group most of my projects in a few output folders and I'm setting OutputPath in Directory.Build.targets using some simple conditions (e.g. test projects go to TestOutput). I also have a few projects that I would like to exclude from these rules as they have a custom OutputPath 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 of OutputPath 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 keeping OutputPath 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageHave yet to determine what bucket this goes in.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions