dotnet / project-system

The .NET Project System for Visual Studio
MIT License
967 stars 386 forks source link

Add CollectNuGetAuditSupressions target #9486

Closed tmeschter closed 3 months ago

tmeschter commented 3 months ago

Related to PR #9470.

After PR #9470, VS and C# Dev Kit will attempt to collect NuGet audit suppression items via the CollectNuGetAuditSuppressions target. However, this target new to the 8.0.400 version of the .NET SDK. If a project is using an older version of the SDK our design-time build will now fail with complaints that the target doesn't exist.

To work around this, here we update Microsoft.Managed.DesignTime.targets to include a no-op version of the target. This file ships with VS and the C# Dev Kit, not the SDK, and so we can guarantee that the target will always be present when we need it. The real definition in the SDK is in NuGet.targets; this file is imported after Microsoft.Managed.DesignTime.targets and so the real definition, when it exists, will automatically replace the no-op definition.

Microsoft Reviewers: Open in CodeFlow