dotnet / project-system

The .NET Project System for Visual Studio
MIT License
959 stars 385 forks source link

Add NuGetAuditSuppress items to NuGet nomination #9470

Closed zivkan closed 1 month ago

zivkan commented 1 month ago

The new version of NuGet.VisualStudio changes nomination datastructure somewhat, introducing a generic IReadOnlyDictionary<string, IReadOnlyList<IVsReferenceItem2>> Items bag, rather than having one property per MSBuild item. This means the next time NuGet wants to add a new item, it will no longer be necessary to update to a newer NuGet.VisualStudio package.

As the title of this PR suggests, the contract was changed because a new project item, NuGetAuditSuppress is now needed. Hence it has been added, in addition to migrating the existing code to the new API.

Microsoft Reviewers: Open in CodeFlow
drewnoakes commented 1 month ago

Microsoft.VisualStudio.TemplateWizardInterface version 17.6.36389 doesn't seem to exist anywhere:

warning NU1603: NuGet.VisualStudio 17.11.0-preview.2.61 depends on Microsoft.VisualStudio.TemplateWizardInterface (>= 17.6.36389) but Microsoft.VisualStudio.TemplateWizardInterface 17.6.36389 was not found. An approximate best match of Microsoft.VisualStudio.TemplateWizardInterface 17.6.36391 was resolved.

Looks like there's an obsoletion to update as well:

CS0618: 'IVsFrameworkParser' is obsolete: 'This API does not support .NET 5 and higher target frameworks with platforms. Use IVsFrameworkParser2 instead.'

As discussed offline, MSBuild property values cannot be null:

CS8619: Nullability of reference types in value of type 'IImmutableDictionary<string, string>' doesn't match target type 'IReadOnlyDictionary<string, string?>'.

I pushed a formatting change to fix:

IDE0090: 'new' expression can be simplified (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090)

There's a unit test failure that needs investigation:

error : [xUnit.net 00:00:14.78] ExportedFieldsMustEndInRule(member: Int32 CollectedNuGetAuditSuppressions) [FAIL]

drewnoakes commented 1 month ago

/azp run

azure-pipelines[bot] commented 1 month ago
Azure Pipelines successfully started running 1 pipeline(s).