Skip to content

Commit d715fd5

Browse files
authored
Merge branch 'main' into openapi-package
2 parents 70db033 + 426949d commit d715fd5

File tree

125 files changed

+6092
-566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+6092
-566
lines changed
File renamed without changes.

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# .git-blame-ignore-revs
2+
# Use file scope namespace
3+
a450cb69b5e4549f5515cdb057a68771f56cefd7

.github/fabricbot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2540,7 +2540,7 @@
25402540
{
25412541
"name": "addMilestone",
25422542
"parameters": {
2543-
"milestoneName": "7.0-preview3"
2543+
"milestoneName": "7.0-preview4"
25442544
}
25452545
}
25462546
],

.vsconfig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@
44
"Microsoft.Net.Component.4.6.2.TargetingPack",
55
"Microsoft.Net.Component.4.7.2.SDK",
66
"Microsoft.Net.Component.4.7.2.TargetingPack",
7+
"Microsoft.VisualStudio.Component.VC.ATL",
8+
"Microsoft.VisualStudio.Component.VC.ATL.ARM64",
9+
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
10+
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
11+
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ARM64",
12+
"Microsoft.VisualStudio.Component.VC.14.29.16.11.x86.x64",
13+
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL.ARM64",
14+
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL",
15+
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
716
"Microsoft.VisualStudio.Workload.ManagedDesktop",
8-
"Microsoft.VisualStudio.Workload.NetCoreTools",
17+
"Microsoft.VisualStudio.Workload.NativeDesktop",
918
"Microsoft.VisualStudio.Workload.NetWeb",
1019
"Microsoft.VisualStudio.Workload.VisualStudioExtension"
1120
]

AspNetCore.sln

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.OpenAp
17061706
EndProject
17071707
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.OpenApi.Tests", "src\Http\OpenApi\test\Microsoft.AspNetCore.OpenApi.Tests.csproj", "{77305727-1A53-402A-A4E8-4CFA0DBFACC6}"
17081708
EndProject
1709+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ResultsOfTGenerator", "src\Http\Http.Results\tools\ResultsOfTGenerator\ResultsOfTGenerator.csproj", "{9716D0D0-2251-44DD-8596-67D253EEF41C}"
1710+
EndProject
17091711
Global
17101712
GlobalSection(SolutionConfigurationPlatforms) = preSolution
17111713
Debug|Any CPU = Debug|Any CPU
@@ -10179,6 +10181,22 @@ Global
1017910181
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|x64.Build.0 = Release|Any CPU
1018010182
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|x86.ActiveCfg = Release|Any CPU
1018110183
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|x86.Build.0 = Release|Any CPU
10184+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
10185+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Debug|Any CPU.Build.0 = Debug|Any CPU
10186+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Debug|arm64.ActiveCfg = Debug|Any CPU
10187+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Debug|arm64.Build.0 = Debug|Any CPU
10188+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Debug|x64.ActiveCfg = Debug|Any CPU
10189+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Debug|x64.Build.0 = Debug|Any CPU
10190+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Debug|x86.ActiveCfg = Debug|Any CPU
10191+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Debug|x86.Build.0 = Debug|Any CPU
10192+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|Any CPU.ActiveCfg = Release|Any CPU
10193+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|Any CPU.Build.0 = Release|Any CPU
10194+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|arm64.ActiveCfg = Release|Any CPU
10195+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|arm64.Build.0 = Release|Any CPU
10196+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|x64.ActiveCfg = Release|Any CPU
10197+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|x64.Build.0 = Release|Any CPU
10198+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|x86.ActiveCfg = Release|Any CPU
10199+
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|x86.Build.0 = Release|Any CPU
1018210200
EndGlobalSection
1018310201
GlobalSection(SolutionProperties) = preSolution
1018410202
HideSolutionNode = FALSE
@@ -11023,6 +11041,7 @@ Global
1102311041
{25642C23-0BB8-4FF7-9181-9599489679EB} = {2D2D1107-7389-473B-BDCE-BFA060EAC453}
1102411042
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4} = {E47D1385-64B3-429B-9B1D-B0D0B7B6E506}
1102511043
{77305727-1A53-402A-A4E8-4CFA0DBFACC6} = {25642C23-0BB8-4FF7-9181-9599489679EB}
11044+
{9716D0D0-2251-44DD-8596-67D253EEF41C} = {323C3EB6-1D15-4B3D-918D-699D7F64DED9}
1102611045
EndGlobalSection
1102711046
GlobalSection(ExtensibilityGlobals) = postSolution
1102811047
SolutionGuid = {3E8720B3-DBDD-498C-B383-2CC32A054E8F}

docs/BuildFromSource.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ Building ASP.NET Core on Windows (10, version 1803 or newer) requires that you h
7474
7575
#### [Visual Studio 2022](https://visualstudio.com)
7676

77-
Visual Studio 2022 (17.1 or above) is required to build the repo locally. If you don't have Visual Studio installed you can run [eng/scripts/InstallVisualStudio.ps1](/eng/scripts/InstallVisualStudio.ps1) to install the exact required dependencies.
77+
Visual Studio 2022 (17.1 or above) is required to build the repo locally.
78+
79+
If you don't have Visual Studio installed you can run [eng/scripts/InstallVisualStudio.ps1](/eng/scripts/InstallVisualStudio.ps1) to install the exact required dependencies.
80+
If you do have Visual Studio installed, you can [import the configuration](https://docs.microsoft.com/en-us/visualstudio/install/import-export-installation-configurations?view=vs-2022#import-a-configuration) from the `.vsconfig` file at the root of the repository to ensure you have all of the required components.
7881

7982
> :bulb: By default, the script will install Visual Studio Enterprise Edition, however you can use a different edition by passing the `-Edition` flag.
8083
> :bulb: To install Visual Studio from the preview channel, you can use the `-Channel` flag to set the channel (`-Channel Preview`).

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ The table below outlines the different docs in this folder and what they are hel
2525
| Submodules | Documentation on working with submodules in Git | Anyone working with submodules in the repo |
2626
| [Triage process](TriageProcess.md)| Overview of the issue triage process used in the repo | Anyone looking to understand the triage process on the repo |
2727
| [Updating Major Version & TFM](UpdatingMajorVersionAndTFM.md)| Instructions for updating the repo branding & TFM in preparation for a new major release | Repo developers who want to know more about our branding & release process |
28+
| [Assembly trimming guide](Trimming.md)| Guidance on adding trimming support to an ASP.NET Core assembly | Repo developers who want to help add support for trimming to ASP.NET Core |

docs/Trimming.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Guide to trimming ASP.NET Core
2+
3+
This guide discusses the steps required to enable, annotate, and verify trimming in ASP.NET Core assemblies. An assembly that supports trimming knows all the types and members it needs at runtime. Unused code is removed when an app is published, reducing app size. Trimming is also a precursor to supporting AOT, which requires knowledge of the APIs used by an app on build.
4+
5+
[Trim self-contained deployments and executables](https://docs.microsoft.com/dotnet/core/deploying/trimming/trim-self-contained) has general documentation for trimming. It includes:
6+
7+
* How to output trim warnings. Typically done by publishing an app.
8+
* How to react to trim warnings. Attributes can be placed on APIs to provide type info, suppress warnings, or verify that an API is incompatible with trimming.
9+
* How to trim libraries.
10+
11+
## Assembly trimming order
12+
13+
Trim assemblies from the bottom up. Order is important because annotating an assembly impacts its dependents and their annotations. Annotating from the bottom up reduces churn.
14+
15+
For example, `Microsoft.AspNetCore.Http` depends on `Microsoft.AspNetCore.Http.Abstractions` so `Microsoft.AspNetCore.Http.Abstractions` should be annotated first.
16+
17+
## Trim an ASP.NET Core assembly
18+
19+
The first step to trimming an ASP.NET Core assembly is adding it to `LinkabilityChecker`. `LinkabilityChecker` is a tool in the ASP.NET Core repo that runs ILLink on its referenced assemblies and outputs trim warnings.
20+
21+
1. Update the project file to enable trimming by adding `<IsTrimmable>true</IsTrimmable>`. This property configures the build to add metadata to the assembly to indicate it supports trimming. It also enables trimming analysis on the project.
22+
2. Run `eng/scripts/GenerateProjectList.ps1` to update the list of projects that are known to be trimmable. The script adds the project to the list of known trimmable projects at [`eng/TrimmableProjects.props`](../eng/TrimmableProjects.props).
23+
3. Open `Tools.slnf`
24+
4. Add the project to `Tools.slnf`.
25+
1. Right-click `LinkabilityCheck` and select *Load Direct Dependencies*.
26+
2. Update the solution filter.
27+
5. Build `LinkabilityChecker`.
28+
29+
`LinkabilityChecker` is required to get a complete list of trim warnings because there isn't enough type information when building an assembly on its own. It's possible to introduce new trim warnings during typical dev work after annotating an assembly for trimming. `LinkabilityChecker` automatically runs on the build server and catches new warnings.
30+
31+
## Fix trim warnings
32+
33+
[Introduction to trim warnings](https://docs.microsoft.com/en-us/dotnet/core/deploying/trimming/fixing-warnings) and [Prepare .NET libraries for trimming](https://docs.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming) discuss how to fix trim warnings. There is also a complete list of all the trim warnings with some more detail.
34+
35+
## Updating the baselines
36+
37+
If a suppressed warning has been resolved, or if new trimmer warnings are to be baselined, run the following command:
38+
39+
```
40+
dotnet build /p:GenerateLinkerWarningSuppressions=true
41+
```
42+
43+
This should update the `WarningSuppressions.xml` files associated with projects.
44+
45+
⚠️ Note that the generated file sometimes messes up formatting for some compiler generated nested types and you may need to manually touch up these files on regenerating. The generated file uses braces `{...}` instead of angle brackets `<...>`:
46+
47+
```diff
48+
- LegacyRouteTableFactory.&lt;&gt;c.{Create}b__2_1(System.Reflection.Assembly)
49+
+ LegacyRouteTableFactory.&lt;&gt;c.&lt;Create&gt;b__2_1(System.Reflection.Assembly)
50+
```

eng/CodeGen.proj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<_RequiresDelayedBuild Include="@(_ProvidesReferenceOrRequiresDelay->WithMetadataValue('RequiresDelayedBuild','true')->Distinct())" />
2525
<_SharedFrameworkAndPackageRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsPackable', 'true'))" />
2626
<_SharedFrameworkRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsPackable', 'false'))" />
27-
<_TrimmableProject Include="@(_ProjectReferenceProvider->WithMetadataValue('Trimmable', 'true'))" />
27+
<_TrimmableProject Include="@(_ProjectReferenceProvider->WithMetadataValue('IsTrimmable', 'true'))" />
2828
</ItemGroup>
2929

3030
<PropertyGroup>
@@ -85,7 +85,7 @@
8585
8686
This file contains a complete list of projects annotated for trimming.
8787
88-
This file is generated using the <Trimmable> properties from each .csproj in this repository.
88+
This file is generated using the <IsTrimmable> properties from each .csproj in this repository.
8989
-->
9090
<Project>
9191
<ItemGroup>

eng/Dependencies.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ and are generated based on the last package release.
190190
<LatestPackageReference Include="MessagePackAnalyzer" />
191191
<LatestPackageReference Include="Microsoft.Data.SqlClient" />
192192
<LatestPackageReference Include="Mono.Cecil" />
193+
<LatestPackageReference Include="Mono.TextTemplating" />
193194
<LatestPackageReference Include="Moq" />
194195
<LatestPackageReference Include="Newtonsoft.Json.Bson" />
195196
<LatestPackageReference Include="NSwag.ApiDescription.Client" />

eng/TrimmableProjects.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
This file contains a complete list of projects annotated for trimming.
55
6-
This file is generated using the <Trimmable> properties from each .csproj in this repository.
6+
This file is generated using the <IsTrimmable> properties from each .csproj in this repository.
77
-->
88
<Project>
99
<ItemGroup>
@@ -20,6 +20,7 @@
2020
<TrimmableProject Include="Microsoft.AspNetCore.Metadata" />
2121
<TrimmableProject Include="Microsoft.AspNetCore.OpenApi" />
2222
<TrimmableProject Include="Microsoft.AspNetCore.Routing.Abstractions" />
23+
<TrimmableProject Include="Microsoft.AspNetCore.Routing" />
2324
<TrimmableProject Include="Microsoft.AspNetCore.WebUtilities" />
2425
<TrimmableProject Include="Microsoft.AspNetCore.Connections.Abstractions" />
2526
<TrimmableProject Include="Microsoft.AspNetCore.Server.HttpSys" />

0 commit comments

Comments
 (0)