Skip to content

Commit

Permalink
Remove Microsoft.Extensions.PlatformAbstractions
Browse files Browse the repository at this point in the history
* fix some vulnerable dependencies
  • Loading branch information
lahma committed Nov 26, 2024
1 parent eb48a5f commit 17cbd11
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/NSwag.Commands/NSwag.Commands.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.2" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0" />
</ItemGroup>
Expand All @@ -34,7 +34,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))" />
<PackageReference Include="NConsole" Version="3.12.6605.26941" />
</ItemGroup>

Expand Down
9 changes: 2 additions & 7 deletions src/NSwag.Commands/RuntimeUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

#if !NETFRAMEWORK
using Microsoft.Extensions.PlatformAbstractions;
#endif

namespace NSwag.Commands
{
/// <summary>Provides runtime utilities.</summary>
Expand All @@ -23,10 +19,9 @@ public static Runtime CurrentRuntime
#if NETFRAMEWORK
return IntPtr.Size == 4 ? Runtime.WinX86 : Runtime.WinX64;
#else
var framework = PlatformServices.Default.Application.RuntimeFramework;
if (framework.Identifier == ".NETCoreApp")
if (!System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.Ordinal))
{
if (framework.Version.Major >= 9)
if (Environment.Version.Major >= 9)
{
return Runtime.Net90;
}
Expand Down
2 changes: 0 additions & 2 deletions src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="9.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="System.Text.Encodings.Web" Version="8.0.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down

0 comments on commit 17cbd11

Please sign in to comment.