Skip to content

Commit 9305d7f

Browse files
Port NuGet Audit back to 9.0 (#108854)
* Enable NuGet Audit and fix issues (#107639) * Enable NuGet Audit and fix issues Microsoft.NET.HostModel can reference the live builds of the packages it depends on. These will be deployed by the SDK.� Most other audit alerts were due to tasks pulling in old dependencies that aren't even used by the task. Avoid these by cherry-picking just the assemblies needed by the tasks and provided by MSBuild / SDK. This prevents NuGet from downloading the package closure with the vulnerable packages. We don't need those packages since the tasks aren't responsible for deploying them. A better solution in the future would be a targeting pack for MSBuild and the .NET SDK - so that components that contribute to these hosts have a surface area they can target without taking on responsibility for servicing. There is once case where we have a test that references NuGet.* packages which also bring in stale dependencies that overlap with framework assemblies. Avoid these by cherry-picking the NuGet packages in the same way. * Fix package path on linux * Only use live JSON from HostModel SDK pins S.R.M and a few others, so don't make them upgrade yet. * Add a couple missing assembly references * Refactor tasks dependencies Consolidate representation of msbuild-provided task dependencies * Fix audit warnings in tests * Remove MetadataLoadContext from WasmAppBuilder package * Update Analyzer.Testing packages * Reduce exposure of Microsoft.Build.Tasks.Core * Fix audit warnings that only occur on browser * Update Asn1 used by linker analyzer tests * React to breaking change in analyzer test SDK * Enable working DryIoc tests * Fix double-write when LibrariesConfiguration differs from Configuration * Fix LibrariesConfiguration update target * Clean up references and add comments. * Make HostModel references private This ensures projects referenced will not be rebuilt by tests. This also means the HostModel package will not list these as references, but that's OK since the SDK provides them and this is not a shipping package. * Use ProjectReferenceExclusion to avoid framework project references On .NETCore we want to use the targeting pack and avoid rebuilding libs. * Update src/libraries/System.Runtime.InteropServices.JavaScript/tests/JSImportGenerator.UnitTest/JSImportGenerator.Unit.Tests.csproj Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com> --------- Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com> * Remove live System.Text.Json reference from HostModel (#108263) * Reduce changes to src/installer Since we're no longer trying to reference live S.T.J we don't need these. * Update JSON toolset version * Don't error for NuGet audit on non-official builds (#108718) * Reference live S.T.JSON from DI.ExternalContainers.Tests * Update STJ in Wasm.Build.Tests * Make SystemTextJsonToolsetVersion 8.0.4 We cannot count on VS and MSBuild updating by the time 9.0 ships GA. Fix WASM projects which only target .NET by referencing the LKG and dropping all assets. For Microsoft.NET.HostModel and other build tasks, keep them on the version we can garuntee is present in VS. NoWarn the Audit warnings here. This is safe because we can ensure one of two things. 1. The package is non-shipping and customers won't see the warning and the referencing repo in the product will ensure an update or exclusion of the dependency. (HostModel) 2. The project excludes the reference entirely as making it PrivateAssets (not in package) and ExcludeAssets=runtime (no possibility of using runtime). * Fix STJ audit warning in installer tests --------- Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
1 parent b8f5d25 commit 9305d7f

File tree

43 files changed

+169
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+169
-118
lines changed

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@
387387
<!-- Enables Strict mode for Roslyn compiler -->
388388
<Features>strict;nullablePublicOnly</Features>
389389
<TreatWarningsAsErrors Condition="'$(TreatWarningsAsErrors)' == ''">true</TreatWarningsAsErrors>
390+
<!-- Only upgrade NuGetAudit warnings to errors for official builds. -->
391+
<WarningsNotAsErrors Condition="'$(OfficialBuild)' != 'true' OR '$(NuGetAuditWarnNotError)' == 'true'">$(WarningsNotAsErrors);NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
390392
<!-- Warnings to always disable -->
391393
<NoWarn>$(NoWarn);CS8500;CS8969</NoWarn>
392394
<!-- Suppress "CS1591 - Missing XML comment for publicly visible type or member" compiler errors for private assemblies. -->

Directory.Build.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@
143143
<Target Name="FilterTransitiveProjectReferences"
144144
AfterTargets="IncludeTransitiveProjectReferences"
145145
Condition="'$(DisableTransitiveProjectReferences)' != 'true' and
146-
'@(DefaultReferenceExclusion)' != ''">
146+
('@(DefaultReferenceExclusion)' != '' or '@(ProjectReferenceExclusion)' != '')">
147147
<ItemGroup>
148148
<_transitiveProjectReferenceWithProjectName Include="@(ProjectReference->Metadata('NuGetPackageId'))"
149149
OriginalIdentity="%(Identity)" />
150150
<_transitiveIncludedProjectReferenceWithProjectName Include="@(_transitiveProjectReferenceWithProjectName)"
151-
Exclude="@(DefaultReferenceExclusion)" />
151+
Exclude="@(DefaultReferenceExclusion);@(ProjectReferenceExclusion)" />
152152
<_transitiveExcludedProjectReferenceWithProjectName Include="@(_transitiveProjectReferenceWithProjectName)"
153153
Exclude="@(_transitiveIncludedProjectReferenceWithProjectName)" />
154154
<ProjectReference Remove="@(_transitiveExcludedProjectReferenceWithProjectName->Metadata('OriginalIdentity'))" />

NuGet.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
2727
<add key="dotnet9-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9-transport/nuget/v3/index.json" />
2828
</packageSources>
29+
<auditSources>
30+
<clear />
31+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
32+
</auditSources>
2933
<disabledPackageSources>
3034
<clear />
3135
</disabledPackageSources>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project>
2+
3+
<!-- These file supports using PackageDownloadAndReference items.
4+
5+
The PackageDownloadAndReference item is used to download a package and reference it in the project, without restoring the package's dependency closure.
6+
7+
When using PackageDownloadAndReference you are responsible for selecting the correct assets from the package and ensuring that the package and it's
8+
dependencies are available at runtime.
9+
10+
The PackageDownloadAndReference item has the following metadata:
11+
- Folder: The folder in the package where the assembly is located.
12+
- AssemblyName: The name of the assembly to reference.
13+
- Private: Whether the reference should be private (copied to the output directory) or not. Default is false.
14+
15+
A common use case for PackageDownloadAndReference is to reference assemblies provided by MSBuild or the .NET SDK.
16+
-->
17+
18+
<ItemDefinitionGroup>
19+
<PackageDownloadAndReference>
20+
<Folder>lib/$(TargetFramework)</Folder>
21+
<AssemblyName>%(Identity)</AssemblyName>
22+
<Private>false</Private>
23+
</PackageDownloadAndReference>
24+
</ItemDefinitionGroup>
25+
26+
<ItemGroup>
27+
<PackageDownload Include="@(PackageDownloadAndReference)" />
28+
<PackageDownload Update="@(PackageDownloadAndReference)" Version="[%(Version)]"/>
29+
<PackageDownloadAndReference Update="@(PackageDownloadAndReference)" PackageFolder="$([System.String]::new(%(Identity)).ToLowerInvariant())" />
30+
<Reference Include="@(PackageDownloadAndReference->'$(NuGetPackageRoot)%(PackageFolder)/%(Version)/%(Folder)/%(AssemblyName).dll')" />
31+
</ItemGroup>
32+
33+
</Project>

eng/Version.Details.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,22 @@
406406
</Dependency>
407407
<!-- Necessary for source-build. This allows the package to be retrieved from previously-source-built artifacts
408408
and flow in as dependencies of the packages produced by runtime. -->
409+
<Dependency Name="Nuget.Frameworks" Version="6.2.4">
410+
<Uri>https://github.com/NuGet/NuGet.Client</Uri>
411+
<Sha>8fef55f5a55a3b4f2c96cd1a9b5ddc51d4b927f8</Sha>
412+
</Dependency>
413+
<Dependency Name="Nuget.Packaging" Version="6.2.4">
414+
<Uri>https://github.com/NuGet/NuGet.Client</Uri>
415+
<Sha>8fef55f5a55a3b4f2c96cd1a9b5ddc51d4b927f8</Sha>
416+
</Dependency>
409417
<Dependency Name="Nuget.ProjectModel" Version="6.2.4">
410418
<Uri>https://github.com/NuGet/NuGet.Client</Uri>
411419
<Sha>8fef55f5a55a3b4f2c96cd1a9b5ddc51d4b927f8</Sha>
412420
</Dependency>
421+
<Dependency Name="Nuget.Versioning" Version="6.2.4">
422+
<Uri>https://github.com/NuGet/NuGet.Client</Uri>
423+
<Sha>8fef55f5a55a3b4f2c96cd1a9b5ddc51d4b927f8</Sha>
424+
</Dependency>
413425
<Dependency Name="runtime.linux-arm64.Microsoft.NETCore.Runtime.Wasm.Node.Transport" Version="9.0.0-alpha.1.24175.1">
414426
<Uri>https://github.com/dotnet/node</Uri>
415427
<Sha>308c7d0f1fa19bd1e7b768ad13646f5206133cdb</Sha>

eng/Versions.props

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
<SystemComponentModelAnnotationsVersion>5.0.0</SystemComponentModelAnnotationsVersion>
120120
<SystemDataSqlClientVersion>4.8.6</SystemDataSqlClientVersion>
121121
<SystemDrawingCommonVersion>8.0.0</SystemDrawingCommonVersion>
122+
<SystemFormatsAsn1Version>8.0.1</SystemFormatsAsn1Version>
122123
<SystemIOFileSystemAccessControlVersion>5.0.0</SystemIOFileSystemAccessControlVersion>
123124
<SystemMemoryVersion>4.5.5</SystemMemoryVersion>
124125
<SystemReflectionMetadataVersion>9.0.0-rtm.24503.8</SystemReflectionMetadataVersion>
@@ -136,7 +137,7 @@
136137
<runtimenativeSystemIOPortsVersion>9.0.0-rtm.24503.8</runtimenativeSystemIOPortsVersion>
137138
<!-- Keep toolset versions in sync with dotnet/msbuild and dotnet/sdk -->
138139
<SystemCollectionsImmutableToolsetVersion>8.0.0</SystemCollectionsImmutableToolsetVersion>
139-
<SystemTextJsonToolsetVersion>8.0.0</SystemTextJsonToolsetVersion>
140+
<SystemTextJsonToolsetVersion>8.0.4</SystemTextJsonToolsetVersion>
140141
<SystemReflectionMetadataToolsetVersion>8.0.0</SystemReflectionMetadataToolsetVersion>
141142
<SystemReflectionMetadataLoadContextToolsetVersion>8.0.0</SystemReflectionMetadataLoadContextToolsetVersion>
142143
<!-- Runtime-Assets dependencies -->
@@ -174,8 +175,10 @@
174175
<MicrosoftBuildTasksCoreVersion>$(MicrosoftBuildVersion)</MicrosoftBuildTasksCoreVersion>
175176
<MicrosoftBuildFrameworkVersion>$(MicrosoftBuildVersion)</MicrosoftBuildFrameworkVersion>
176177
<MicrosoftBuildUtilitiesCoreVersion>$(MicrosoftBuildVersion)</MicrosoftBuildUtilitiesCoreVersion>
178+
<NugetFrameworksVersion>6.2.4</NugetFrameworksVersion>
177179
<NugetProjectModelVersion>6.2.4</NugetProjectModelVersion>
178180
<NugetPackagingVersion>6.2.4</NugetPackagingVersion>
181+
<NugetVersioningVersion>6.2.4</NugetVersioningVersion>
179182
<DotnetSosVersion>7.0.412701</DotnetSosVersion>
180183
<DotnetSosTargetFrameworkVersion>6.0</DotnetSosTargetFrameworkVersion>
181184
<!-- Testing -->
@@ -205,7 +208,7 @@
205208
<GrpcCoreVersion>2.46.3</GrpcCoreVersion>
206209
<GrpcDotnetClientVersion>2.45.0</GrpcDotnetClientVersion>
207210
<GrpcToolsVersion>2.45.0</GrpcToolsVersion>
208-
<CompilerPlatformTestingVersion>1.1.2-beta1.23323.1</CompilerPlatformTestingVersion>
211+
<CompilerPlatformTestingVersion>1.1.3-beta1.24423.1</CompilerPlatformTestingVersion>
209212
<CompilerPlatformTestingDiffPlexVersion>1.7.2</CompilerPlatformTestingDiffPlexVersion>
210213
<CompilerPlatformTestingMicrosoftVisualBasicVersion>10.2.0</CompilerPlatformTestingMicrosoftVisualBasicVersion>
211214
<CompilerPlatformTestingMicrosoftVisualStudioCompositionVersion>17.0.46</CompilerPlatformTestingMicrosoftVisualStudioCompositionVersion>

src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@
1919
</PropertyGroup>
2020

2121
<ItemGroup>
22+
<!-- SDK pins this to a lower version https://github.com/dotnet/sdk/issues/43325 -->
2223
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataToolsetVersion)" />
23-
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonToolsetVersion)" />
24+
<!-- The SDK distributes the live version of Json we can't reference that https://github.com/dotnet/runtime/issues/108262 -->
25+
<!-- We suppress all audit warnings for this reference. This package is non-shipping, the only consumer is the SDK which
26+
will provide the correct version or depend on MSBuild to provide it -->
27+
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonToolsetVersion)" NoWarn="NU1901;NU1902;NU1903;NU1904" />
2428
</ItemGroup>
2529

2630
<ItemGroup>

src/installer/tests/Directory.Build.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<Project>
22

3+
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
4+
<!-- Update and drop package assets from Json, we'll use the framework version -->
5+
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" PrivateAssets="All" ExcludeAssets="All" />
6+
</ItemGroup>
7+
38
<Target Name="SetupTestContextVariables"
49
Condition="'$(IsTestProject)' == 'true'"
510
DependsOnTargets="

src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/Microsoft.DotNet.CoreSetup.Packaging.Tests.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
<ItemGroup>
1010
<PackageReference Include="NuGet.Packaging" Version="$(NugetPackagingVersion)" />
11+
<!-- Upgrade to a non-vulnerable version of Asn1 - which will be ignored in favor of the framework copy -->
12+
<PackageReference Include="System.Formats.Asn1" Version="$(SystemFormatsAsn1Version)" ExcludeAssets="All" />
1113
</ItemGroup>
1214

1315
<ItemGroup>

src/libraries/Common/tests/System/Net/Security/Kerberos/System.Net.Security.Kerberos.Shared.projitems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@
3636
</ItemGroup>
3737
<ItemGroup>
3838
<PackageReference Include="Kerberos.NET" Version="4.5.178" />
39+
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Cryptography.Pkcs\src\System.Security.Cryptography.Pkcs.csproj" />
3940
</ItemGroup>
4041
</Project>

src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.External.Tests/DryIoc.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ namespace Microsoft.Extensions.DependencyInjection.Specification
99
{
1010
public class DryIocDependencyInjectionSpecificationTests : SkippableDependencyInjectionSpecificationTests
1111
{
12-
public override bool SupportsIServiceProviderIsService => false;
13-
14-
public override string[] SkippedTests => new[]
15-
{
16-
"ServiceScopeFactoryIsSingleton"
17-
};
12+
public override string[] SkippedTests => [];
1813

1914
protected override IServiceProvider CreateServiceProviderImpl(IServiceCollection serviceCollection)
2015
{

src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.External.Tests/Microsoft.Extensions.DependencyInjection.ExternalContainers.Tests.csproj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,21 @@
1818
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.DependencyInjection\src\Microsoft.Extensions.DependencyInjection.csproj" SkipUseReferenceAssembly="true" />
1919
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.DependencyInjection.Abstractions\src\Microsoft.Extensions.DependencyInjection.Abstractions.csproj" SkipUseReferenceAssembly="true" />
2020
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.DependencyInjection.Specification.Tests\src\Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj" />
21-
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
22-
<PackageReference Include="DryIoc.Microsoft.DependencyInjection" Version="5.1.0" />
23-
<PackageReference Include="LightInject.Microsoft.DependencyInjection" Version="3.5.0" />
21+
<ProjectReference Include="$(LibrariesProjectRoot)System.Text.Json\src\System.Text.Json.csproj" />
22+
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
23+
<PackageReference Include="DryIoc.Microsoft.DependencyInjection" Version="6.2.0" />
24+
<PackageReference Include="LightInject.Microsoft.DependencyInjection" Version="3.7.1" />
2425
<PackageReference Include="Grace.DependencyInjection.Extensions" Version="7.1.0" />
2526
<PackageReference Include="Stashbox.Extensions.Dependencyinjection" Version="4.2.3" />
2627
</ItemGroup>
2728

2829
<!-- These packages don't support .NETFramework -->
2930
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
3031
<PackageReference Include="Lamar.Microsoft.DependencyInjection" Version="8.0.1" />
32+
<!-- Lamar depends on System.Runtime.Loader which brings in 1.x packages.
33+
Those have audit warnings when runtime.* packages are brought in for RID-specific restore.
34+
Avoid by referencing the latest Microsoft.NETCore.Targets which will prevent all 1.x runtime.* packages from being referenced. -->
35+
<PackageReference Include="Microsoft.NETCore.Targets" Version="5.0.0" />
3136
</ItemGroup>
3237

3338
</Project>

src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<ItemGroup>
2020
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj" />
2121
<PackageReference Include="Microsoft.CodeAnalysis" Version="$(RoslynApiVersion)" />
22+
<!-- Ensure we are using live dependencies for CodeAnalysis rather than old packages -->
23+
<PackageReference Include="NETStandard.Library" Version="$(NETStandardLibraryVersion)" />
24+
<ProjectReference Include="$(LibrariesProjectRoot)System.Composition\src\System.Composition.csproj" />
25+
<ProjectReference Include="$(LibrariesProjectRoot)System.IO.Pipelines\src\System.IO.Pipelines.csproj" />
26+
<ProjectReference Include="$(LibrariesProjectRoot)System.Reflection.Metadata\src\System.Reflection.Metadata.csproj" />
2227
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="$(SQLitePCLRawbundle_greenVersion)" />
2328
</ItemGroup>
2429

src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,16 @@
4141
</ItemGroup>
4242

4343
<ItemGroup>
44-
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" />
45-
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
44+
<!-- Manually reference these assemblies which are provided by MSBuild / .NET SDK -->
45+
<PackageDownloadAndReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" Folder="ref/net472" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net472'))" />
46+
<PackageDownloadAndReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" Folder="ref/net8.0" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))" />
47+
<PackageDownloadAndReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" Folder="ref/net472" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net472'))" />
48+
<PackageDownloadAndReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" Folder="ref/net8.0" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))" />
49+
<PackageDownloadAndReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" Folder="lib/netstandard2.0" />
4650
</ItemGroup>
47-
51+
52+
<Import Project="$(RepositoryEngineeringDir)PackageDownloadAndReference.targets" />
53+
4854
<UsingTask TaskName="UpdateRuntimeIdentifierGraph" AssemblyFile="$(_generateRuntimeGraphTask)"/>
4955
<Target Name="UpdateRuntimeIdentifierGraph"
5056
AfterTargets="Build"

src/libraries/Microsoft.XmlSerializer.Generator/tests/SerializableAssembly.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)">
12-
<PrivateAssets>all</PrivateAssets>
13-
</PackageReference>
11+
<ProjectReference Include="$(LibrariesProjectRoot)System.Reflection.Metadata\src\System.Reflection.Metadata.csproj" />
1412
</ItemGroup>
1513

1614
<ItemGroup>

src/libraries/System.Private.CoreLib/tests/IntrinsicsInSystemPrivatecoreLibAnalyzer.Tests/IntrinsicsInSystemPrivateCoreLib.Tests.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<PackageReference Include="DiffPlex" Version="$(CompilerPlatformTestingDiffPlexVersion)" />
1616
<PackageReference Include="Microsoft.VisualBasic" Version="$(CompilerPlatformTestingMicrosoftVisualBasicVersion)" />
1717
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="$(CompilerPlatformTestingMicrosoftVisualStudioCompositionVersion)" />
18+
<!-- Upgrade to a non-vulnerable version of Asn1 - which will be ignored in favor of the framework copy -->
19+
<PackageReference Include="System.Formats.Asn1" Version="$(SystemFormatsAsn1Version)" ExcludeAssets="All" />
1820
</ItemGroup>
1921

2022
<ItemGroup>

src/libraries/System.Runtime.InteropServices.JavaScript/tests/JSImportGenerator.UnitTest/JSImportGenerator.Unit.Tests.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
44
<Nullable>enable</Nullable>
55
<TestRunRequiresLiveRefPack>true</TestRunRequiresLiveRefPack>
6-
<IgnoreForCI Condition="'$(TargetsMobile)' == 'true' or '$(TargetsLinuxBionic)' == 'true' or '$(TargetArchitecture)' == 'ARMv6'">true</IgnoreForCI>
6+
<IgnoreForCI Condition="'$(TargetsMobile)' == 'true' or '$(TargetsLinuxBionic)' == 'true' or '$(TargetArchitecture)' == 'ARMv6'">true</IgnoreForCI>
77
</PropertyGroup>
88
<ItemGroup>
99
<Compile Include="$(CommonTestPath)SourceGenerators\LiveReferencePack.cs" Link="Common\SourceGenerators\LiveReferencePack.cs" />
@@ -25,6 +25,9 @@
2525
<PackageReference Include="Microsoft.VisualBasic" Version="$(CompilerPlatformTestingMicrosoftVisualBasicVersion)" />
2626
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="$(CompilerPlatformTestingMicrosoftVisualStudioCompositionVersion)" />
2727

28+
<!-- Upgrade to a non-vulnerable version of Asn1 - which will be ignored in favor of the framework copy -->
29+
<PackageReference Include="System.Formats.Asn1" Version="$(SystemFormatsAsn1Version)" ExcludeAssets="all" />
30+
2831
<None Include="$(RepoRoot)/NuGet.config" Link="NuGet.config" CopyToOutputDirectory="PreserveNewest" />
2932
</ItemGroup>
3033
</Project>

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/ComInterfaceGenerator.Unit.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
<PackageReference Include="DiffPlex" Version="$(CompilerPlatformTestingDiffPlexVersion)" />
3434
<PackageReference Include="Microsoft.VisualBasic" Version="$(CompilerPlatformTestingMicrosoftVisualBasicVersion)" />
3535
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="$(CompilerPlatformTestingMicrosoftVisualStudioCompositionVersion)" />
36+
37+
<!-- Upgrade to a non-vulnerable version of Asn1 - which will be ignored in favor of the framework copy -->
38+
<PackageReference Include="System.Formats.Asn1" Version="$(SystemFormatsAsn1Version)" ExcludeAssets="All" />
3639
</ItemGroup>
3740

3841
<ItemGroup>

src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/CustomMarshallerAttributeFixerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal class CustomMarshallerAttributeFixerTest : CSharpCodeFixVerifier<Custom
2222
// In particular, sort the equivalent subgroups by their diagnostic descriptor in the order that the fixer's fix-all provider
2323
// will add the methods.
2424
// This ensures that the iterative code-fix test will produce the same (deterministic) output as the fix-all tests.
25-
protected override ImmutableArray<(Project project, Diagnostic diagnostic)> SortDistinctDiagnostics(IEnumerable<(Project project, Diagnostic diagnostic)> diagnostics)
25+
protected override ImmutableArray<(Project project, Diagnostic diagnostic)> SortDistinctDiagnostics(ImmutableArray<(Project project, Diagnostic diagnostic)> diagnostics)
2626
=> diagnostics.OrderBy(d => d.diagnostic.Location.GetLineSpan().Path, StringComparer.Ordinal)
2727
.ThenBy(d => d.diagnostic.Location.SourceSpan.Start)
2828
.ThenBy(d => d.diagnostic.Location.SourceSpan.End)

src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/LibraryImportGenerator.Unit.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
<PackageReference Include="DiffPlex" Version="$(CompilerPlatformTestingDiffPlexVersion)" />
4949
<PackageReference Include="Microsoft.VisualBasic" Version="$(CompilerPlatformTestingMicrosoftVisualBasicVersion)" />
5050
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="$(CompilerPlatformTestingMicrosoftVisualStudioCompositionVersion)" />
51+
52+
<!-- Upgrade to a non-vulnerable version of Asn1 - which will be ignored in favor of the framework copy -->
53+
<PackageReference Include="System.Formats.Asn1" Version="$(SystemFormatsAsn1Version)" ExcludeAssets="All" />
5154
</ItemGroup>
5255

5356
<ItemGroup>

src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/SerializationTypes/SerializationTypes.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
<EnableLibraryImportGenerator>false</EnableLibraryImportGenerator>
1414
</PropertyGroup>
1515

16-
<ItemGroup>
17-
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)">
18-
<PrivateAssets>all</PrivateAssets>
19-
</PackageReference>
20-
</ItemGroup>
21-
2216
<ItemGroup>
2317
<Compile Include="*.cs" />
2418
</ItemGroup>

0 commit comments

Comments
 (0)