Skip to content

Add support to native Windows ARM64 with fallback to Win64#419

Open
micha102 wants to merge 1 commit intovideolan:3.xfrom
micha102:3.x
Open

Add support to native Windows ARM64 with fallback to Win64#419
micha102 wants to merge 1 commit intovideolan:3.xfrom
micha102:3.x

Conversation

@micha102
Copy link

Description of Change

Add support to native Windows ARM64 with fallback to Win64.
It allows LibVLCSharp to detect win-arm64 in Core.cs and add fallback to win-x64 folders to preserve compatibility.
It complements mfkl/libvlc-nuget#53 and corresponding PR , which added ARM64 binaries, allowing WPF apps on Windows ARM devices to load LibVLC natively.

Issues Resolved

API Changes

Added:

  • internal const string ArchitectureNames.WinArm64 in Constants.cs
  • else if (PlatformHelper.IsWindows) { ... } branch in Core.cs to detect Architecture.Arm64
  • Fallback search paths for win-x64 when running on win-arm64 in Core.cs

Platforms Affected

  • Windows ARM64
  • Windows X64 (now including inside branch else if (PlatformHelper.IsWindows) )
  • Windows ARM64 (now including inside branch else if (PlatformHelper.IsWindows) )

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

git clone https://github.com/micha102/libvlcsharp.git
exclude Android, iOS and few others
dotnet pack src/LibVLCSharp/LibVLCSharp.csproj -c Win32Release
dotnet pack src/LibVLCSharp.WPF/LibVLCSharp.WPF.csproj -c Win32Release

PR Checklist

  • Rebased on top of the target branch at time of PR
  • Changes adhere to coding standard

@micha102 micha102 marked this pull request as draft March 13, 2026 14:35
Wrap Windows ARM64 detection in #if !NET40 && !NETSTANDARD1_1 to fix CI running on NET40
@micha102
Copy link
Author

micha102 commented Mar 13, 2026

I added detection of CPU and Bitness for Windows when .NET is greater than 4.0
Well, that defeats the CI pipeline which is presently compiling against net40 as I saw in the last falied CI build.

The thing is if I implement the detection with .NET 4.0, then I need to use Windows specific code.
So, I also need to define a constant matching Windows targeting, otherwise Linux and MacOS builds will complain.

So, in Directory.Build.props, need to add a tag for WINDOWS (there's a WINDOWS_MODERN tag for UWP so that's good)

  <PropertyGroup Condition="'$(Configuration)' == 'Win32Debug'">
    <DefineConstants>$(DefineConstants);WINDOWS;DEBUG</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'Win32Release'">
    <DefineConstants>$(DefineConstants);WINDOWS;RELEASE</DefineConstants>
  </PropertyGroup>

Then, in PlatformHelper.cs, need to add

public static bool IsWindowsArm64
{
#if (WINDOWS || WINDOWS_MODERN) && NET40
    get
    {
        SYSTEM_INFO info;
        GetNativeSystemInfo(out info);
        return info.wProcessorArchitecture == ProcessorArchitecture.Arm64;
    }
#elif (WINDOWS || WINDOWS_MODERN) && !NETSTANDARD1_1
    get => IsWindows && RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
#else
    get => false;
#endif
}

And finally I can do Core.cs a simple

else if (PlatformHelper.IsWindowsArm64)
{
    arch = ArchitectureNames.WinArm64;
}

But since, Windows ARM64 is newly supported, I don't think it's worth it to implement detection for .NET 4.0

Let me know if it's OK, or I must implement it for .NET 4.0 too.

@micha102 micha102 marked this pull request as ready for review March 13, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant