Skip to content

Commit 57d7bae

Browse files
authored
Enable Central Package Management and NuGetAudit (#390)
Contributes to dotnet/arcade#15019 - Remove unnecessary package source feeds - Move version properties into D.Packages.props as those aren't auto-updated. - Enable NuGetAudit and make vulnerabilities to only fail the official build.
1 parent fbf353c commit 57d7bae

File tree

7 files changed

+38
-22
lines changed

7 files changed

+38
-22
lines changed

Directory.Build.props

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,15 @@
7878
PackagePath="/" />
7979
</ItemGroup>
8080

81-
<!-- Language configuration -->
8281
<PropertyGroup>
82+
<!-- Language configuration -->
8383
<Deterministic>true</Deterministic>
8484
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
85-
</PropertyGroup>
8685

87-
<PropertyGroup>
8886
<CodeAnalysisRuleset>$(RepositoryEngineeringDir)CodeAnalysis.ruleset</CodeAnalysisRuleset>
87+
88+
<!-- Only upgrade NuGetAudit warnings to errors for official builds. -->
89+
<WarningsNotAsErrors Condition="'$(OfficialBuild)' != 'true'">$(WarningsNotAsErrors);NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
8990
</PropertyGroup>
9091

9192
</Project>

Directory.Packages.props

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
5+
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
6+
<!-- Using multiple feeds isn't supported by Maestro: https://github.com/dotnet/arcade/issues/14155. -->
7+
<NoWarn>$(NoWarn);NU1507</NoWarn>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<!-- MSBuild dependencies -->
12+
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="17.9.5" />
13+
14+
<!-- Runtime dependencies -->
15+
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.0" />
16+
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
17+
<PackageVersion Include="System.Formats.Asn1" Version="8.0.1" /> <!-- Pin transitive dependency to avoid vulnerable 8.0.0 version. -->
18+
</ItemGroup>
19+
20+
<!-- DotNetBuild overrides needed until https://github.com/dotnet/source-build/issues/4467 is implemented. -->
21+
<ItemGroup>
22+
<PackageVersion Update="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" Condition="'$(MicrosoftBuildTasksCoreVersion)' != ''" />
23+
<PackageVersion Update="System.Security.Cryptography.Xml" Version="$(SystemSecurityCryptographyXmlVersion)" Condition="'$(SystemSecurityCryptographyXmlVersion)' != ''" />
24+
<PackageVersion Update="System.Text.Json" Version="$(SystemTextJsonVersion)" Condition="'$(SystemTextJsonVersion)' != ''" />
25+
</ItemGroup>
26+
27+
</Project>

NuGet.config

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
<packageSources>
99
<clear />
1010
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
11-
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
1211
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
13-
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
14-
<add key="dotnet8-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8-transport/nuget/v3/index.json" />
1512
</packageSources>
13+
<auditSources>
14+
<clear />
15+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
16+
</auditSources>
1617
<disabledPackageSources>
1718
<clear />
1819
</disabledPackageSources>

eng/Version.Details.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<Dependencies>
22
<ProductDependencies>
3-
<!-- Intermediate is necessary for source build. -->
4-
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="8.0.0-alpha.1.23518.1">
5-
<Uri>https://github.com/dotnet/source-build-externals</Uri>
6-
<Sha>3dc05150cf234f76f6936dcb2853d31a0da1f60e</Sha>
7-
<SourceBuild RepoName="source-build-externals" ManagedOnly="true" />
8-
</Dependency>
93
<!-- Intermediate is necessary for source build. -->
104
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="10.0.0-alpha.1.24421.1">
115
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>

eng/Versions.props

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,4 @@
1212
<StabilizePackageVersion Condition="'$(StabilizePackageVersion)' == ''">false</StabilizePackageVersion>
1313
<DotNetFinalVersionKind Condition="'$(StabilizePackageVersion)' == 'true'">release</DotNetFinalVersionKind>
1414
</PropertyGroup>
15-
<PropertyGroup>
16-
<!-- Runtime dependencies -->
17-
<SystemTextJsonVersion>8.0.3</SystemTextJsonVersion>
18-
<SystemSecurityCryptographyXmlVersion>8.0.0</SystemSecurityCryptographyXmlVersion>
19-
<!-- MSBuild dependencies -->
20-
<MicrosoftBuildTasksCoreVersion>17.9.5</MicrosoftBuildTasksCoreVersion>
21-
</PropertyGroup>
2215
</Project>

src/Microsoft.Deployment.DotNet.Releases/src/Microsoft.Deployment.DotNet.Releases.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" />
26+
<PackageReference Include="System.Text.Json" />
2727
</ItemGroup>
2828

2929
<ItemGroup>

src/clickonce/MageCLI/MageCLI.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
</ItemGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" />
35-
<PackageReference Include="System.Security.Cryptography.Xml" Version="$(SystemSecurityCryptographyXmlVersion)" />
34+
<PackageReference Include="Microsoft.Build.Tasks.Core" />
35+
<PackageReference Include="System.Security.Cryptography.Xml" />
3636
</ItemGroup>
3737

3838
<ItemGroup>

0 commit comments

Comments
 (0)