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

Create a macOS universal binary #313

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
21 changes: 20 additions & 1 deletion src/dotnet-core-uninstall/dotnet-core-uninstall.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>dotnet-core-uninstall</AssemblyName>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x86;osx-x64</RuntimeIdentifiers>
<RuntimeIdentifiers>win-x86;osx-x64;osx-arm64</RuntimeIdentifiers>
<SignAssembly>true</SignAssembly>
<TargetFramework>net8.0</TargetFramework>
<RollForward>LatestMajor</RollForward>
Expand Down Expand Up @@ -37,4 +37,23 @@
</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

<ItemGroup>
<_Rids Include="osx-x64;osx-arm64" />
<_RidSpecificBuild Include="$(MSBuildThisFile)" AdditionalProperties="RuntimeIdentifier=%(_Rids.Identity);PublishSingleFile=true;Configuration=Release;PublishSelfContained=true;" />
</ItemGroup>

<MSBuild Projects="@(_RidSpecificBuild)" BuildInParallel="true" Targets="Publish;PublishItemsOutputGroup">
<Output TaskParameter="TargetOutputs" ItemName="_RidSpecificSingleFile" />
</MSBuild>
<PropertyGroup>
<_LipoOutputDir>$(PublishDir)\osx-universal\</_LipoOutputDir>
<_LipoOutputPath>$(_LipoOutputDir)$(AssemblyName)</_LipoOutputPath>
</PropertyGroup>

<MakeDir Directories="$(_LipoOutputDir)" />

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

</Project>