Skip to content

Verify projects for required properties #75

@omidkrad

Description

@omidkrad

I opened a question on StackOverflow for how to check Visual Studio projects (.csproj files) for consistency in their property settings. Apparently there is no straightforward way to do this and you have to either write custom tasks or manually parse .csproj files as XML for testing project properties.

I think this is a good feature to be added to Invoke-MSBuild. Right now, Invoke-MSBuild has a -properties parameter which passes these parameters for build but it does not test projects for having them. For example if you pass -properties @{'WarningLevel'='4'} it will ignore the current WarningLevel property in projects and use the specified value instead. But what if you want the build to fail with proper error message if WarningLevel in any of the building projects is not 4? I've seen different team invent their own stuff to implement this kind of verification in their projects.

I suggest adding a new parameter to Invoke-MSBuild just for this, like -requireProperties that will cause the build to fail if any of the projects does not comply with the specified property requirements.

One thing to notice is, if -configuration Debug is specified together with -requireProperties $hash then required properties will be checked only for the Debug condition. For this we may want to alternatively have the option to pass an MSBuild project with all required properties on different conditions and get Invoke-MSBuild to verify that every project being built follows that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions