mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-12 07:16:51 +00:00
fix(build): add netstandard2.0 target to eliminate System.Runtime version mismatch
The net9.0 DLL references System.Runtime 9.0.0.0 which is unavailable on GitHub runners where pwsh ships with .NET 8.x. Adding netstandard2.0 as a target produces a DLL compatible with any .NET version (PS 5.1 on .NET Framework through PS 7.x on .NET 8/9). - Add netstandard2.0 to TargetFrameworks in Core and module csproj - Update #if NET48 conditionals to include NETSTANDARD2_0 - Switch CI workflows from net9.0 to netstandard2.0 for Pester tests - Update _TestHelper.ps1 framework search order Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ using Newtonsoft.Json.Linq;
|
||||
using PSProxmoxVE.Core.Authentication;
|
||||
using PSProxmoxVE.Core.Exceptions;
|
||||
|
||||
#if NET48
|
||||
#if NET48 || NETSTANDARD2_0
|
||||
using System.Net.Security;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
#endif
|
||||
@@ -35,7 +35,7 @@ namespace PSProxmoxVE.Core.Client
|
||||
_session = session ?? throw new ArgumentNullException(nameof(session));
|
||||
_baseUrl = session.BaseUrl;
|
||||
|
||||
#if NET48
|
||||
#if NET48 || NETSTANDARD2_0
|
||||
var handler = new HttpClientHandler();
|
||||
if (session.SkipCertificateCheck)
|
||||
{
|
||||
@@ -75,7 +75,7 @@ namespace PSProxmoxVE.Core.Client
|
||||
_session = null;
|
||||
_baseUrl = $"https://{hostname}:{port}";
|
||||
|
||||
#if NET48
|
||||
#if NET48 || NETSTANDARD2_0
|
||||
var handler = new HttpClientHandler();
|
||||
if (skipCertificateCheck)
|
||||
{
|
||||
@@ -286,7 +286,7 @@ namespace PSProxmoxVE.Core.Client
|
||||
}
|
||||
finally
|
||||
{
|
||||
#if NET48
|
||||
#if NET48 || NETSTANDARD2_0
|
||||
fileStream.Dispose();
|
||||
#else
|
||||
await fileStream.DisposeAsync().ConfigureAwait(false);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net9.0;net48</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard2.0;net9.0;net48</TargetFrameworks>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>PSProxmoxVE.Core</RootNamespace>
|
||||
@@ -16,6 +16,11 @@
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net48'">
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net9.0;net48</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard2.0;net9.0;net48</TargetFrameworks>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>PSProxmoxVE</RootNamespace>
|
||||
@@ -14,7 +14,7 @@
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net48'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'net48'">
|
||||
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user