.NET project file analyzers community

Proj1702: Omit XML declarations

The XML Declaration provides basic information about the format for the rest of the XML document. It takes the form of a Processing Instruction and can have the attributes version, encoding and standalone. All of this is redunant for MS Build project files, and hence the XML declaration should be omitted.

Non-compliant

<?xml version="1.0" encoding="UTF-8"?>
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>

</Project>

Compliant

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>

</Project>