Skip to content

More robust identification of the build OS in Microsoft.AspNetCore.App.Runtime.csproj #37400

Open
@omajid

Description

@omajid

<!--
Determine the crossgen2 package path property name. Special case linux-musl-arm and linux-musl-arm64 because they
are built on an Ubuntu container with cross compilation tools. linux-musl-x64 is built in an alpine container.
Special case the crossgen2 package reference on Windows to avoid the x86 package when building in Visual Studio.
-->
<BuildOsName>$(TargetOsName)</BuildOsName>
<BuildOsName Condition="'$(TargetOsName)' == 'linux-musl' and '$(TargetArchitecture)'!='x64'">linux</BuildOsName>
<Crossgen2BuildArchitecture Condition=" '$(BuildOsName)' == 'win' ">x64</Crossgen2BuildArchitecture>
<Crossgen2BuildArchitecture Condition=" '$(Crossgen2BuildArchitecture)' == '' ">$(BuildArchitecture)</Crossgen2BuildArchitecture>
<Crossgen2PackageRootVariableName>PkgMicrosoft_NETCore_App_Crossgen2_$(BuildOsName)-$(Crossgen2BuildArchitecture)</Crossgen2PackageRootVariableName>

This hardcodes some assumptions that are valid in the CI legs, but may not be in other systems.

For example, if this project is being built on Linux arm64 hardware using an OS that uses musl - in other words, linux-musl-arm64, it will try and use the linux-arm64 crossgen2 instead.

Another example, if this code is being built on Windows on arm64 (or really, any architecture that's not x64), it will use the wrong crossgen, win-x64, which will most likely fail to run on an Arm 64 machine.

See also this comment posted by @dougbu in #37374 (comment)

@dougbu

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-infrastructureIncludes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions