Skip to content

Commit 1073446

Browse files
authored
Publish the AotCompatibility.TestApp project as part of PR validation (#5622)
- Remove AI in Microsoft.Extensions.AI.AotCompatibility.TestApp so it can be used for all projects - Analyze all libraries except the ones that have current warnings - Publish the app from the AzDO pipeline - Clean up the AotCompatibility.TestApp - Remove unnecessary code in Program.cs by turning off ReferenceTrimmer - Make the project publishable without passing in a TFM by only targeting a single TFM - Fix part of Compliance.Redaction trimming issues by reenabling the Config Binder source generator.
2 parents 6487428 + 4cd0228 commit 1073446

File tree

6 files changed

+43
-49
lines changed

6 files changed

+43
-49
lines changed

eng/pipelines/templates/BuildAndTest.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ steps:
6868
condition: always()
6969
continueOnError: true
7070
71+
- script: $(Build.SourcesDirectory)/.dotnet/dotnet publish
72+
workingDirectory: $(Build.SourcesDirectory)/test/Libraries/Microsoft.Extensions.AotCompatibility.TestApp
73+
displayName: Publish AOT Test
74+
7175
- ${{ if ne(parameters.skipQualityGates, 'true') }}:
7276
- ${{ if eq(parameters.runAsPublic, 'true') }}:
7377
- task: PublishPipelineArtifact@1

src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77

88
<PropertyGroup>
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
10+
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
1011
<InjectStringSyntaxAttributeOnLegacy>true</InjectStringSyntaxAttributeOnLegacy>
1112
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
1213
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
1314
<InjectSharedNumericExtensions>true</InjectSharedNumericExtensions>
1415
<InjectSharedDataValidation>true</InjectSharedDataValidation>
1516

16-
<!-- using the ConfigurationBinder source generator is blocked by https://github.com/dotnet/runtime/issues/94547 -->
17+
<!-- https://github.com/dotnet/extensions/issues/5623 -->
1718
<IsAotCompatible>false</IsAotCompatible>
1819
<NoWarn>$(NoWarn);IL2026</NoWarn>
1920
</PropertyGroup>

test/Libraries/Microsoft.Extensions.AI.AotCompatibility.TestApp/Microsoft.Extensions.AI.AotCompatibility.TestApp.csproj

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/Libraries/Microsoft.Extensions.AI.AotCompatibility.TestApp/Program.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>$(LatestTargetFramework)</TargetFramework>
6+
<!-- clear TargetFrameworks because it is set in ..\Directory.Build.props -->
7+
<TargetFrameworks></TargetFrameworks>
8+
<PublishAot>true</PublishAot>
9+
<TrimmerSingleWarn>false</TrimmerSingleWarn>
10+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<!-- Remove the ReferenceTrimmer analyzer. We explicitly want to reference every assembly so the AOT compiler sees it. -->
15+
<PackageReference Remove="ReferenceTrimmer" />
16+
17+
<LibraryProjects Include="$(RepoRoot)\src\Libraries\**\*.csproj" />
18+
<!-- https://github.com/Azure/azure-sdk-for-net/issues/47069 -->
19+
<LibraryProjects Remove="$(RepoRoot)\src\Libraries\Microsoft.Extensions.AI.AzureAIInference\Microsoft.Extensions.AI.AzureAIInference.csproj" />
20+
<!-- https://github.com/openai/openai-dotnet/issues/20 -->
21+
<LibraryProjects Remove="$(RepoRoot)\src\Libraries\Microsoft.Extensions.AI.OpenAI\Microsoft.Extensions.AI.OpenAI.csproj" />
22+
<!-- https://github.com/dotnet/extensions/issues/5624 -->
23+
<LibraryProjects Remove="$(RepoRoot)\src\Libraries\Microsoft.Extensions.Caching.Hybrid\Microsoft.Extensions.Caching.Hybrid.csproj" />
24+
<!-- https://github.com/dotnet/extensions/issues/5623 -->
25+
<LibraryProjects Remove="$(RepoRoot)\src\Libraries\Microsoft.Extensions.Compliance.Redaction\Microsoft.Extensions.Compliance.Redaction.csproj" />
26+
<!-- https://github.com/dotnet/extensions/issues/5625 -->
27+
<LibraryProjects Remove="$(RepoRoot)\src\Libraries\Microsoft.Extensions.Http.Resilience\Microsoft.Extensions.Http.Resilience.csproj" />
28+
29+
<TrimmerRootAssembly Include="@(LibraryProjects->'%(FileName)')" />
30+
<ProjectReference Include="@(LibraryProjects)" />
31+
</ItemGroup>
32+
33+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
System.Console.WriteLine("Success!");

0 commit comments

Comments
 (0)