Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 1.04 KB

File metadata and controls

29 lines (23 loc) · 1.04 KB

Proj0005: Define package reference assets as attributes

You might want to control the dependency assets of the package reference, and define its preferences. For readability purposes, it is preferred to define PrivateAssets, IncludeAssets, and PrivateAsssets as XML attributes, instead of XML elements.

Non-compliant

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

  <ItemGroup Label="Analyzers">
    <PackageReference Include="DotNetProjectFile.Analyzers">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  </ItemGroup>

</Project>

Compliant

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

  <ItemGroup Label="Analyzers">
    <PackageReference Include="DotNetProjectFile.Analyzers" Version="*" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
  </ItemGroup>

</Project>