Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/generate-and-build-sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ jobs:
strategy:
fail-fast: false
matrix:
dotnet: ["6", "8"]
dotnet: ["8"]
needs: build-csharp-sdk
runs-on: windows-2022
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Retrieve PowerShell 7.x SDK distribution artifacts
uses: actions/download-artifact@v4
with:
name: SDK_Binaries_XenServerPowerShell_NET6
name: SDK_Binaries_XenServerPowerShell_NET8
path: sdk_powershell_7x/

- name: Package C SDK artifacts for deployment
Expand Down
16 changes: 12 additions & 4 deletions ocaml/sdk-gen/powershell/autogen/src/Connect-XenServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
using System.IO;
using System.Management.Automation;
using System.Net;
#if NET8_0_OR_GREATER
using System.Net.Http;
#endif
using System.Net.Security;
using System.Runtime.InteropServices;
using System.Security;
Expand Down Expand Up @@ -159,7 +162,7 @@ protected override void ProcessRecord()
}

ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

if (Url == null || Url.Length == 0)
{
Expand Down Expand Up @@ -209,7 +212,7 @@ protected override void ProcessRecord()
throw;
}
}
catch (WebException e)
catch (Exception e)
{
var inner = e.InnerException?.InnerException ?? //.NET case
e.InnerException; //.NET Framework case
Expand Down Expand Up @@ -271,8 +274,13 @@ private bool ValidateServerCertificate(object sender, X509Certificate certificat
bool ignoreChanged = Force || NoWarnCertificates || (bool)GetVariableValue("NoWarnCertificates", false);
bool ignoreNew = Force || NoWarnNewCertificates || (bool)GetVariableValue("NoWarnNewCertificates", false);

HttpWebRequest webreq = (HttpWebRequest)sender;
string hostname = webreq.Address.Host;
#if NET8_0_OR_GREATER
var requestMessage = sender as HttpRequestMessage;
string hostname = requestMessage?.RequestUri?.Host ?? string.Empty;
#else
var webreq = sender as HttpWebRequest;
string hostname = webreq?.Address?.Host ?? string.Empty;
#endif
string fingerprint = CommonCmdletFunctions.FingerprintPrettyString(certificate.GetCertHashString());

bool trusted = VerifyInAllStores(new X509Certificate2(certificate));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>0.0.0</Version>
<TargetFrameworks>net8.0;net6.0;net45</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<TargetFrameworks>net8.0;net45</TargetFrameworks>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>True</GenerateAssemblyInfo>
</PropertyGroup>
Expand All @@ -12,9 +12,6 @@
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="System.Management.Automation" Version="7.4.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.Management.Automation" Version="7.2.18" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<PackageReference Include="Microsoft.PowerShell.5.ReferenceAssemblies" Version="1.1.0" />
</ItemGroup>
Expand Down
Loading