Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement XML Linting for .csproj and Related Files #43583

Open
JonDouglas opened this issue Sep 19, 2024 · 3 comments
Open

Implement XML Linting for .csproj and Related Files #43583

JonDouglas opened this issue Sep 19, 2024 · 3 comments
Labels
Area-NetSDK msbuild-analyzer-candidate Items that would be a good MSBuild Analyzer untriaged Request triage from a team member

Comments

@JonDouglas
Copy link

Is your feature request related to a problem? Please describe.

Over the years, I have observed recurring challenges associated with various XML-based project files in the .NET ecosystem, including .csproj, .props, and others. Currently, there is no integrated linter to validate these XML files, which leads to several issues:

Invisible Syntax Errors: Minor mistakes such as missing closing tags (/>) or incorrect nesting can go unnoticed during manual editing. These errors are often not apparent until a build fails, causing frustration and wasting developer time.

Inconsistent Formatting: Without linting, XML files may suffer from inconsistent formatting, making them harder to read and maintain, especially in collaborative environments.

Silent Failures: Some XML errors may not produce clear or immediate feedback, resulting in builds that fail for obscure reasons, complicating the debugging process.

An example of these challenges is documented in NuGet/Home#13469, where the absence of proper linting led to unforeseen issues that could have been prevented with better XML validation.

Describe the solution you'd like

I propose the integration of an XML linting feature within the .NET SDK that specifically targets project-related XML files such as .csproj, .props, and others.

It should validate syntax, enforce basic formatting, report errors, and maybe real time linting in tooling.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Sep 19, 2024
@richlander
Copy link
Member

+1 ... I had to use a binlog to realize that Directory.Packages.props was not being read, hence why I was seeing 100s of errors. Was very unproductive.

@baronfel
Copy link
Member

@rainersigwald @JanKrivanek would this kind of check be doable by a buildcheck?

@rainersigwald
Copy link
Member

Not really today, but this is a reasonable extension. We do have dotnet/msbuild#1777 to track other linting.

@baronfel baronfel added the msbuild-analyzer-candidate Items that would be a good MSBuild Analyzer label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK msbuild-analyzer-candidate Items that would be a good MSBuild Analyzer untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

4 participants