From ec6f0825d97f95ebbac116b63f1550ce552c0de8 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 18 Jul 2023 15:04:34 -0700 Subject: [PATCH] Add EnableGeneratedComInterfaceComImportInterop property to control the source-generated/built-in COM interop interaction feature switch. (#34072) --- .../targets/Microsoft.NET.Sdk.Analyzers.targets | 1 + .../targets/Microsoft.NET.Sdk.targets | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets index 80877bd2c6c4..6b71c3d0422c 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets @@ -132,6 +132,7 @@ Copyright (c) .NET Foundation. All rights reserved. of built-in and source generated COM interop --> + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets index 7af32d2c072e..61ba663f2670 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets @@ -27,7 +27,7 @@ Copyright (c) .NET Foundation. All rights reserved. - + $(_IsNETCoreOrNETStandard) @@ -147,7 +147,7 @@ Copyright (c) .NET Foundation. All rights reserved. If the property is explicitly set to TRUE: - The APIs are obsolete as warning, and calls to the APIs will succeed at runtime. - + If the property is explicitly set to FALSE: - On .NET 5 & 6, the APIs are obsolete as warning, and calls to the APIs will fail at runtime. - On .NET 7+, the APIs are obsolete as error, and calls to the APIs will fail at runtime. @@ -157,7 +157,7 @@ Copyright (c) .NET Foundation. All rights reserved. - On .NET 7, the APIs are obsolete as error, but calls to the APIs will succeed at runtime. - On .NET 8+, the APIs are obsolete as error, and calls to the APIs will fail at runtime unless the SDK has opted in to keeping legacy BinaryFormatter behavior around. - + n.b. The APIs are already marked obsolete (as warning) in .NET 5, so we don't need to special-case them unless we want to upgrade them to warn-as-error. --> @@ -206,7 +206,7 @@ Copyright (c) .NET Foundation. All rights reserved. If they do, and they also set BuildWithNetFrameworkHostedCompiler, we will have a duplicate PackageReference. This makes it more explicit that that is not supported. --> + Condition="'@(PackageReference->AnyHaveMetadataValue('Identity', 'Microsoft.Net.Compilers.Toolset.Framework'))' == 'true'" /> @@ -503,7 +503,7 @@ Copyright (c) .NET Foundation. All rights reserved. - + @@ -573,6 +573,11 @@ Copyright (c) .NET Foundation. All rights reserved. Value="$(EnableCppCLIHostActivation)" Trim="true" /> + + <_UseAttributeForTargetFrameworkInfoPropertyNames Condition="$([MSBuild]::VersionGreaterThanOrEquals($(MSBuildVersion), '17.0'))">true - +