File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7070 <ItemGroup >
7171 <PackageReference Include =" JetBrains.Annotations" Version =" 2026.2.*" PrivateAssets =" All" />
7272 </ItemGroup >
73+
74+ <ItemGroup >
75+ <!--
76+ Workaround: Swashbuckle 11.x (used on net10.0/net11.0) was compiled against Microsoft.OpenApi 3.9.0.
77+ CS1705 prevents compiling against a lower version, so we compile against 3.9.0 and overwrite
78+ the output DLL with 3.7.0 at runtime. PackageDownload ensures 3.7.0 is in the NuGet cache.
79+ See the UseOpenApi370AtRuntime target in Directory.Build.targets.
80+ -->
81+ <PackageDownload Include =" Microsoft.OpenApi" Version =" [3.7.0]" />
82+ </ItemGroup >
7383</Project >
Original file line number Diff line number Diff line change 11<Project >
2+ <!--
3+ Workaround: Swashbuckle 11.x (used on net10.0/net11.0) was compiled against Microsoft.OpenApi 3.9.0, so
4+ CS1705 prevents us from downgrading it at compile time. We compile against 3.9.0 and then overwrite
5+ the output DLL with 3.7.0 so the runtime uses the desired version. The Exists() condition limits this
6+ to executable/test projects (they copy transitive package DLLs to output; library projects don't).
7+ PackageDownload in Directory.Build.props ensures the 3.7.0 DLL is present in the NuGet cache.
8+ -->
9+ <Target Name =" UseOpenApi370AtRuntime" AfterTargets =" Build"
10+ Condition =" ('$(TargetFramework)' == 'net11.0' OR '$(TargetFramework)' == 'net10.0') AND Exists('$(OutputPath)Microsoft.OpenApi.dll')" >
11+ <PropertyGroup >
12+ <_NuGetPackagesRoot Condition =" '$(NUGET_PACKAGES)' != ''" >$(NUGET_PACKAGES)</_NuGetPackagesRoot >
13+ <_NuGetPackagesRoot Condition =" '$(_NuGetPackagesRoot)' == ''" >$(UserProfile)\.nuget\packages</_NuGetPackagesRoot >
14+ <_OpenApi370Dll >$(_NuGetPackagesRoot)\microsoft.openapi\3.7.0\lib\net8.0\Microsoft.OpenApi.dll</_OpenApi370Dll >
15+ </PropertyGroup >
16+ <Copy SourceFiles =" $(_OpenApi370Dll)" DestinationFolder =" $(OutputPath)" OverwriteReadOnlyFiles =" true"
17+ Condition =" Exists('$(_OpenApi370Dll)')" />
18+ </Target >
19+
220 <Target Name =" DisableCompileTimeOpenApiXmlGenerator" BeforeTargets =" CoreCompile" >
321 <ItemGroup >
422 <Analyzer Remove =" @(Analyzer)" Condition =" '%(Filename)' == 'Microsoft.AspNetCore.OpenApi.SourceGenerators'" />
You can’t perform that action at this time.
0 commit comments