Repository navigation
Treat OpenHarmony as Unix-like in MSBuild - #15342
Merged
JanProvaznik merged 2 commits intoOct 26, 2026
Merged
Conversation
NativeMethodsShared.IsUnixLike only checks Linux/macOS/BSD/Haiku. On OpenHarmony OSPlatformName is OPENHARMONY, so Exec writes Windows-style .exec.cmd scripts and the NativeAOT linker probe fails. Add IsOpenHarmony via OSPlatform.Create("OPENHARMONY").
springmin
marked this pull request as ready for review
October 22, 2026 15:01
springmin
temporarily deployed
to
copilot-pat-pool
October 22, 2026 15:01 — with
GitHub Actions
Inactive
springmin
temporarily deployed
to
copilot-pat-pool
October 22, 2026 15:04 — with
GitHub Actions
Inactive
JanProvaznik
approved these changes
Oct 26, 2026
Member
|
note: msbuild is not supported on OpenHarmony, but I see no reason not to make the community build work here |
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MSBuild's
NativeMethodsShared.IsUnixLikeonly checks Linux, macOS, BSD, andHaiku. On OpenHarmony,
RuntimeInformation.IsOSPlatform(OSPlatform.Linux)isfalse (
OSPlatformNameisOPENHARMONY), soExecwrites Windows-style.exec.cmdscripts and the NativeAOT linker probe fails with "linker notfound" even though
clang++is onPATH.Add an
IsOpenHarmonycheck usingOSPlatform.Create("OPENHARMONY")to theUnix-like set.
This is the correct layer: dotnet/runtime#136211 was closed because
OperatingSystem.IsOSPlatform(OSPlatform.Linux)should not return true forOpenHarmony (Android follows the same rule).
Test
CI: 14 passed, 0 failed, 7 skipped.
No unit test:
IsUnixLikeis a platform predicate, and the existingNativeMethodsSharedtests only run on Linux and Windows.Device (OpenHarmony 7.0.0.111, arm64): with this MSBuild build,
dotnet publish -r openharmony-arm64 -p:PublishAot=truecompletes, and theproduced NativeAOT executable runs on the device (
rc=0):The current runtime reports both
LinuxandOPENHARMONY, so it alreadytakes the Unix path through
IsLinux; the new predicate covers runtimesthat report only
OPENHARMONY.Note
This PR was drafted with AI assistance (agent tooling) under the author's direction.