Skip to content

Commit

Permalink
Add EnableGeneratedComInterfaceComImportInterop property to control t…
Browse files Browse the repository at this point in the history
…he source-generated/built-in COM interop interaction feature switch. (#34072)
  • Loading branch information
jkoritzinsky committed Jul 18, 2023
1 parent 7f7048a commit ec6f082
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Copyright (c) .NET Foundation. All rights reserved.
of built-in and source generated COM interop
-->
<CompilerVisibleProperty Include="EnableComHosting" />
<CompilerVisibleProperty Include="EnableGeneratedComInterfaceComImportInterop" />
</ItemGroup>

<!-- C# Code Style Analyzers -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<UsingTask TaskName="GenerateDepsFile" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<UsingTask TaskName="GenerateRuntimeConfigurationFiles" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<UsingTask TaskName="GetAssemblyVersion" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<UsingTask TaskName="GenerateSatelliteAssemblies" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<UsingTask TaskName="GenerateSatelliteAssemblies" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />

<PropertyGroup>
<DisableStandardFrameworkResolution Condition="'$(DisableStandardFrameworkResolution)' == ''">$(_IsNETCoreOrNETStandard)</DisableStandardFrameworkResolution>
Expand Down Expand Up @@ -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.
Expand All @@ -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.
-->
Expand Down Expand Up @@ -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. -->
<NETSdkWarning ResourceName="CannotDirectlyReferenceMicrosoftNetCompilersToolsetFramework"
Condition="'@(PackageReference->AnyHaveMetadataValue('Identity', 'Microsoft.Net.Compilers.Toolset.Framework'))' == 'true'" />
Condition="'@(PackageReference->AnyHaveMetadataValue('Identity', 'Microsoft.Net.Compilers.Toolset.Framework'))' == 'true'" />

<ItemGroup Condition="'$(BuildWithNetFrameworkHostedCompiler)' == 'true' and '$(OS)' == 'Windows_NT'">
<PackageReference Include="Microsoft.Net.Compilers.Toolset.Framework" PrivateAssets="all" Version="$(_NetFrameworkHostedCompilersVersion)" IsImplicitlyDefined="true" />
Expand Down Expand Up @@ -503,7 +503,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<RuntimeHostConfigurationOption Include="System.GC.DynamicAdaptationMode"
Condition="'$(GarbageCollectionAdaptationMode)' != ''"
Value="$(GarbageCollectionAdaptationMode)" />

<RuntimeHostConfigurationOption Include="System.GC.RetainVM"
Condition="'$(RetainVMGarbageCollection)' != ''"
Value="$(RetainVMGarbageCollection)" />
Expand Down Expand Up @@ -573,6 +573,11 @@ Copyright (c) .NET Foundation. All rights reserved.
Value="$(EnableCppCLIHostActivation)"
Trim="true" />

<RuntimeHostConfigurationOption Include="System.Runtime.InteropServices.Marshalling.EnableGeneratedComInterfaceComImportInterop"
Condition="'$(EnableGeneratedComInterfaceComImportInterop)' != ''"
Value="$(EnableGeneratedComInterfaceComImportInterop)"
Trim="true" />

<RuntimeHostConfigurationOption Include="System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization"
Condition="'$(EnableUnsafeBinaryFormatterSerialization)' != ''"
Value="$(EnableUnsafeBinaryFormatterSerialization)"
Expand Down Expand Up @@ -1205,7 +1210,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup>
<_UseAttributeForTargetFrameworkInfoPropertyNames Condition="$([MSBuild]::VersionGreaterThanOrEquals($(MSBuildVersion), '17.0'))">true</_UseAttributeForTargetFrameworkInfoPropertyNames>
</PropertyGroup>

<Target Name="ValidateExecutableReferences"
AfterTargets="_GetProjectReferenceTargetFrameworkProperties"
Condition="'$(ValidateExecutableReferencesMatchSelfContained)' != 'false'">
Expand Down

0 comments on commit ec6f082

Please sign in to comment.