Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Windows x64 and arm64 builds #1846

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dennisameling
Copy link

@dennisameling dennisameling commented Feb 27, 2025

Currently, GCM is only offered as an x86 build for Windows. On arm64, this results in poor performance because the code has to be fully emulated.

Luckily, dotnet fully supports win-arm64 nowadays. Even the .NET Framework supports it! Here's some more details.

This PR follows the same logic as #1633, which added support for Linux arm64. The main git-credential-manager.exe executable now becomes native, while the DLLs remain Any CPU. This allows for .NET Framework to run natively on arm64. I also added win-x64 while at it.

Confirmed to work correctly both on x64 and arm64 for GitHub operations.

x64

Schermafbeelding 2025-02-27 154529

arm64

image

Comment on lines -30 to +36
run: dotnet build --configuration WindowsRelease
run: |
dotnet build src/windows/Installer.Windows/Installer.Windows.csproj `
--configuration=Release `
--runtime=${{ matrix.runtime }}
Copy link
Author

Choose a reason for hiding this comment

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

Interestingly, dotnet build doesn't support setting --runtime at the solution level. I basically took the same logic as #1633 by setting it at the project level: the Installer.Windows project has all the necessary dependencies so this builds correctly.

Comment on lines -35 to +43
<Exec Condition="'$(NoLayout)'!='true'" Command="powershell.exe –NonInteractive –ExecutionPolicy Unrestricted -Command &quot;&amp; {&amp;'$(MSBuildProjectDirectory)\layout.ps1' -Configuration '$(Configuration)' -Output '$(PayloadPath)'}&quot;" />
<Exec Condition="'$(NoLayout)'!='true'"
ConsoleToMSBuild="true"
Command="powershell.exe –NonInteractive –ExecutionPolicy Unrestricted -Command &quot;&amp; {&amp;'$(MSBuildProjectDirectory)\layout.ps1' -Configuration '$(Configuration)' -Output '$(PayloadPath)' -RuntimeIdentifier '$(RuntimeIdentifier)'; if ($?) { exit 0 } else { exit 1 }}&quot;"
IgnoreExitCode="true">
<!-- If we want to display the console output if the exit code is not 0, we need to capture it and then output it using the <Error /> below -->
<Output TaskParameter="ExitCode" PropertyName="ExitCodeOfExec" />
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
<Error Condition="'$(NoLayout)'!='true' AND '$(ExitCodeOfExec)' != '0'" Text="Layout script failed with exit code $(ExitCodeOfExec) and message $(OutputOfExec)" />
Copy link
Author

Choose a reason for hiding this comment

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

While updating layout.ps1, this initially just errored with the non-helpful ... exited with code 1. The changes here ensure that the actual output of the layout.ps1 script will also be shown in case it fails.

Comment on lines +73 to +80
; Windows ARM64 supports installing and running x64 binaries, but not vice versa.
#if GcmRuntimeIdentifier=="win-x64"
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
#elif GcmRuntimeIdentifier=="win-arm64"
ArchitecturesAllowed=arm64
ArchitecturesInstallIn64BitMode=arm64
#endif
Copy link
Author

@dennisameling dennisameling Feb 27, 2025

Choose a reason for hiding this comment

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

With this logic, the supported installation types are:

Machine x86 GCM installer x64 GCM installer arm64 GCM installer
x86
x64
arm64

This ensures that e.g. x64 Windows can not accidentally install the arm64 GCM version, which it can't run. If you want, we could even make this more strict and force users of x64 Windows to install the x64 version and prohibit installation of the x86 version on that architecture, even though it will work on there as well. But that probably goes a bit too far.

Also, on x64 and arm64, this will install GCM into C:\Program Files\Git Credential Manager instead of C:\Program Files (x86)\Git Credential Manager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant