Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

baronfel
Copy link
Member

Adds a target that

  • creates arch-specific macos binaries
  • stitches them together using lipo to create a universal binary (thanks @rolfbjarne!)

Things we need to think about:

  • how are these signed/notarized?
  • how is the universal binary passed to the rest of the build process in the azdo pipelines?
  • How does the azdo pipeline on mac call the build? Because we'd need it to either call this new target directly or have this target be a dependency of the existing build entry point

cc @joeloff / @marcpopMSFT

<_LipoOuputPath>$(PublishDir)\osx-universal\$(AssemblyName)</_LipoOuputPath>
</PropertyGroup>

<Exec Command="lipo @(_RidSpecificSingleFile, ' ') -create -output $(_LipoOuputPath)" Condition="$([MSBuild]::IsOSPlatform('OSX'))" />
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if you care, but this won't work if any of these paths have spaces in them.

@baronfel
Copy link
Member Author

Tested this on a m2 machine and it works as expected:

% file dotnet-core-uninstall 
dotnet-core-uninstall: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
dotnet-core-uninstall (for architecture x86_64):	Mach-O 64-bit executable x86_64
dotnet-core-uninstall (for architecture arm64):	Mach-O 64-bit executable arm64

@joeloff
Copy link
Member

joeloff commented Oct 29, 2024

Don't think we do notarization for this.

</EmbeddedResource>
</ItemGroup>

<Target Name="PublishMacOSUniversalBinary">
Copy link
Member

Choose a reason for hiding this comment

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

who/what calls this target?

Copy link
Member Author

Choose a reason for hiding this comment

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

I need help making the macOS build call this - it's one of the questions in the issue description :)

Copy link
Member

Choose a reason for hiding this comment

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

probably here: https://github.com/dotnet/cli-lab/blob/25e91f1d39ad446131c0fe4bc998c5a33e766773/.vsts-ci.yml#L137C1-L144C33

You can tweak the .yml, then push your branch internal to trigger an official build against your branch, that's the only way to verify yaml changes

@edvilme edvilme force-pushed the macos-universal-binary branch from 9aa602d to 9256923 Compare April 4, 2025 20:17
@edvilme edvilme force-pushed the macos-universal-binary branch from 9256923 to e0ea109 Compare April 4, 2025 20:21
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.

3 participants