Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 713 Bytes

File metadata and controls

27 lines (21 loc) · 713 Bytes

Proj0242: Generate NuGet packages conditionally

To ensure that packages are not interdependently shipped in DEBUG (or other) mode, a conditional statement should be defined on <GeneratePackageOnBuild> or any of it ancestor nodes. Doing so, NuGet's artifacts are only generated during a RELEASE (or other intendend) build mode.

Non-compliant

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

  <PropertyGroup>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
  </PropertyGroup>

</Project>

Compliant

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

  <PropertyGroup Condition="'$(Configuration)'=='Release'">
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
  </PropertyGroup>

</Project>