Use the new Microsoft.DotNet.PackageValidation on Microsoft.Extensions* packages...
authorAnirudh Agnihotry <anirudhagnihotry098@gmail.com>
Mon, 24 May 2021 21:48:17 +0000 (14:48 -0700)
committerGitHub <noreply@github.com>
Mon, 24 May 2021 21:48:17 +0000 (14:48 -0700)
* enabling the new validation on extensions packages

* use most recent version namespace fixes

* use the new pacakge version with the path fix

* editing the comments

global.json
src/libraries/Directory.Build.props
src/libraries/Directory.Build.targets
src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj
src/libraries/Microsoft.Extensions.DependencyInjection/src/Microsoft.Extensions.DependencyInjection.csproj
src/libraries/Microsoft.Extensions.DependencyModel/src/Microsoft.Extensions.DependencyModel.csproj
src/libraries/Microsoft.Extensions.HostFactoryResolver/src/Microsoft.Extensions.HostFactoryResolver.Sources.csproj

index 1f4b469..28faaff 100644 (file)
@@ -13,6 +13,7 @@
   },
   "msbuild-sdks": {
     "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "6.0.0-beta.21271.3",
+    "Microsoft.DotNet.PackageValidation" : "1.0.0-preview.6.21274.7",
     "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21271.3",
     "Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.21271.3",
     "Microsoft.DotNet.SharedFramework.Sdk": "6.0.0-beta.21271.3",
index 4493657..e9cd76e 100644 (file)
@@ -73,6 +73,8 @@
   <!-- Import packaging props -->
   <Import Project="$(RepositoryEngineeringDir)packaging.props" />
 
+  <Import Sdk="Microsoft.DotNet.PackageValidation" Project="Sdk.props" Condition="'$(IsSourceProject)' == 'true'" />
+
   <PropertyGroup>
     <RefRootPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ref'))</RefRootPath>
   </PropertyGroup>
index cb27773..f166ddc 100644 (file)
     <PackageReference Include="Microsoft.DotNet.GenFacades" Version="$(MicrosoftDotNetGenFacadesVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
   </ItemGroup>
 
+  <Import Sdk="Microsoft.DotNet.PackageValidation" Project="Sdk.targets" Condition="'$(IsSourceProject)' == 'true' and !Exists('$(PkgProjPath)')" />
+
+  <PropertyGroup>
+    <PackageValidationBaselineVersion Condition="'$(PackageValidationBaselineVersion)' == ''">$([MSBuild]::Subtract($(MajorVersion), 1)).0.0</PackageValidationBaselineVersion>
+    <EnablePackageBaselineValidation Condition="'$(IsPackable)' == 'true' and '$(MSBuildProjectExtension)' != '.pkgproj' and '$(EnablePackageBaselineValidation)' == ''">true</EnablePackageBaselineValidation>
+  </PropertyGroup>
+
   <Target Name="SetGenApiProperties"
           BeforeTargets="GenerateReferenceAssemblySource">
     <PropertyGroup>
index 2364f7b..8a2a6e7 100644 (file)
@@ -5,6 +5,7 @@
     <EnableDefaultItems>true</EnableDefaultItems>
     <CLSCompliant>false</CLSCompliant>
     <IsRuntimeAssembly>false</IsRuntimeAssembly>
+    <PackageValidationBaselineVersion>3.1.15</PackageValidationBaselineVersion>
     <PackageDescription>Suite of xUnit.net tests to check for container compatibility with Microsoft.Extensions.DependencyInjection.</PackageDescription>
   </PropertyGroup>
 
index 59a2999..9884fdc 100644 (file)
@@ -5,6 +5,8 @@
     <!-- Debug IL generation -->
     <ILEmitBackendSaveAssemblies>False</ILEmitBackendSaveAssemblies>
     <Nullable>Annotations</Nullable>
+    <!-- Type 'Microsoft.Extensions.DependencyInjection.ServiceCollection' has been forwaded down.-->
+    <NoWarn>$(NoWarn);CP0001</NoWarn>
     <PackageDescription>Default implementation of dependency injection for Microsoft.Extensions.DependencyInjection.</PackageDescription>
   </PropertyGroup>
   
index 81b60b7..b7ccc5b 100644 (file)
@@ -2,6 +2,8 @@
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
     <EnableDefaultItems>true</EnableDefaultItems>
+    <!-- PKV006 is due to intentional removal of .NETFramework,Version=v4.5.1, .NETStandard,Version=v1.3 and NETStandard,Version=v1.6 target frameworks from the package as they are no longer supported. -->
+    <NoWarn>$(NoWarn);PKV006</NoWarn>
     <PackageDescription>Abstractions for reading `.deps` files.
 
 Commonly Used Types:
index 747450d..8d18a80 100644 (file)
@@ -6,6 +6,8 @@
     <IsShipping>false</IsShipping>
     <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
     <IsSourcePackage>true</IsSourcePackage>
+    <!-- This is non-shipping package. -->
+    <EnablePackageBaselineValidation>false</EnablePackageBaselineValidation>
     <PackageDescription>Internal package for sharing Microsoft.Extensions.Hosting.HostFactoryResolver type.</PackageDescription>
   </PropertyGroup>