Skip to content

Update Microsoft.ML.OnnxRuntime.Foundry Package#27294

Merged
baijumeswani merged 5 commits intomainfrom
baijumeswani/update-for-foundry-package
Feb 11, 2026
Merged

Update Microsoft.ML.OnnxRuntime.Foundry Package#27294
baijumeswani merged 5 commits intomainfrom
baijumeswani/update-for-foundry-package

Conversation

@baijumeswani
Copy link
Contributor

This pull-request addresses a few issues with the Microsoft.ML.OnnxRuntime.Foundry:

  • Builds arm64 as opposed to previous arm64ec for windows arm64.
  • Signs the nuget package.
  • Updates target props by checking if onnxruntime.dll exists before attempting to copy. This is a bugfix where if one tries to install any non arm64 package on an arm64 machine (for example when one uses Microsoft.ML.OnnxRuntime.Gpu on windows arm64) it always tries to copy the win-arm64 onnxruntime.dll which does not exist.
  • Takes a dependency on Microsoft.ML.OnnxRuntime.Gpu.Linux for the foundry package.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Microsoft.ML.OnnxRuntime.Foundry packaging pipeline and related build/restore behaviors to better support Windows ARM64 and Foundry’s dependency/signing requirements.

Changes:

  • Switch Windows ARM64 packaging from --arm64ec to --arm64.
  • Add a dedicated Foundry local NuGet packaging stage template with ESRP signing.
  • Fix MSBuild props to only copy ARM/ARM64 native DLLs when they exist, avoiding restore/build failures on ARM64 machines for non-ARM64 packages.
  • Add a NuGet dependency so Foundry pulls in Microsoft.ML.OnnxRuntime.Gpu.Linux.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
tools/nuget/generate_nuspec_for_native_nuget.py Adds Microsoft.ML.OnnxRuntime.Gpu.Linux dependency when generating dependencies for the Foundry package.
tools/ci_build/github/azure-pipelines/templates/foundry-local-nuget-packaging.yml New Azure Pipelines template for creating/signing the Foundry local NuGet package from downloaded artifacts.
tools/ci_build/github/azure-pipelines/custom-nuget-packaging-pipeline.yml Updates ARM64 build flag and switches Foundry packaging logic to the new template.
csharp/src/Microsoft.ML.OnnxRuntime/targets/netstandard/props.xml Adds Exists(...) checks before copying ARM/ARM64 onnxruntime.dll to output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@tianleiwu tianleiwu left a comment

Choose a reason for hiding this comment

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

Review Summary for PR 27294: Update Microsoft.ML.OnnxRuntime.Foundry Package

Overview

This PR focuses on improving the Microsoft.ML.OnnxRuntime.Foundry package by:

  1. Windows ARM64 Support: Switching from arm64ec to pure arm64.
  2. Refactoring: Moving packaging logic to a new template foundry-local-nuget-packaging.yml.
  3. Bug Fix: Preventing build failures on ARM64 machines when non-native packages invoke props.xml checks.
  4. Dependencies: Adding Microsoft.ML.OnnxRuntime.Gpu.Linux as a dependency.
  5. Platform Support: Explicit removal of osx-x64 support from this custom package.

Detailed Changes

1. Build Logic Refactoring

File: tools/ci_build/github/azure-pipelines/custom-nuget-packaging-pipeline.yml -> tools/ci_build/github/azure-pipelines/templates/foundry-local-nuget-packaging.yml

  • Change: The explicit packaging steps were removed from the main pipeline file and modularized into a new reuseable template foundry-local-nuget-packaging.yml.
  • Impact: Improves pipeline readability and reusability. The logic for downloading artifacts, processing them (including the new osx-arm64 directory handling), and signing (ESRP) is now encapsulated.

2. Platform Support Changes (OSX & Windows ARM64)

Files: tools/nuget/generate_nuspec_for_custom_nuget.py, tools/ci_build/github/azure-pipelines/templates/foundry-local-nuget-packaging.yml

  • OSX-X64 Removal: The support for osx-x64 has been removed from generate_nuspec_for_custom_nuget.py and is not present in the new pipeline template.
    • Note: Ensure this removal is intentional for the Foundry package.
  • Windows ARM64: The PR description mentions "Builds arm64 as opposed to previous arm64ec". The pipeline now explicitly handles win-arm64 artifacts.

3. MSBuild Props Fix

File: csharp/src/Microsoft.ML.OnnxRuntime/targets/netstandard/props.xml

  • Change: Added Condition="Exists(...)" checks before copying the native onnxruntime.dll.
    <None Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64\native\onnxruntime.dll')" Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64\native\onnxruntime.dll">
  • Impact: This is a robust fix. Previously, if a project referenced a package that didn't contain the ARM64 binary (e.g., Microsoft.ML.OnnxRuntime.Gpu which might lack win-arm64 support) on an ARM64 machine, the build would fail trying to copy a non-existent file. This change safely skips the copy if the file is missing.

4. Dependency Updates

File: tools/nuget/generate_nuspec_for_native_nuget.py

  • Change: Added dependency for Microsoft.ML.OnnxRuntime.Foundry package.
    if package_name == "Microsoft.ML.OnnxRuntime.Foundry":
        xml_text.append('<dependency id="Microsoft.ML.OnnxRuntime.Gpu.Linux"' + ' version="' + version + '"/>')
  • Impact: Ensures that consuming the Foundry package also pulls in the Linux GPU runtime.

Verification & Questions

  • Confirm OSX-X64 Removal: The removal of osx-x64 support is clear in the code (generate_nuspec_for_custom_nuget.py). Just double-checking if this aligns with the Foundry package requirements.
  • ARM64EC vs ARM64: The switch to arm64 (native) from arm64ec is mentioned. The pipeline changes seem to align with treating it as standard win-arm64.

Conclusion

The changes look solid and address the stated goals. The refactoring improves maintainability, and the props.xml fix is a good quality-of-life improvement for ARM64 developers.

Review Result: Looks good.

@baijumeswani baijumeswani merged commit 26cc7ce into main Feb 11, 2026
101 of 102 checks passed
@baijumeswani baijumeswani deleted the baijumeswani/update-for-foundry-package branch February 11, 2026 23:58
tianleiwu pushed a commit that referenced this pull request Feb 12, 2026
This pull-request addresses a few issues with the
Microsoft.ML.OnnxRuntime.Foundry:

- Builds arm64 as opposed to previous arm64ec for windows arm64.
- Signs the nuget package.
- Updates target props by checking if onnxruntime.dll exists before
attempting to copy. This is a bugfix where if one tries to install any
non arm64 package on an arm64 machine (for example when one uses
Microsoft.ML.OnnxRuntime.Gpu on windows arm64) it always tries to copy
the win-arm64 onnxruntime.dll which does not exist.
- Takes a dependency on Microsoft.ML.OnnxRuntime.Gpu.Linux for the
foundry package.
tianleiwu added a commit that referenced this pull request Feb 13, 2026
This cherry-picks the following commits for the 1.24.2 release:
- #27096
- #27077
- #26677
- #27238
- #27213
- #27256
- #27278
- #27275
- #27276
- #27216
- #27271
- #27299
- #27294
- #27266
- #27176
- #27126
- #27252

---------

Co-authored-by: Xiaofei Han <[email protected]>
Co-authored-by: Jiajia Qin <[email protected]>
Co-authored-by: Yulong Wang <[email protected]>
Co-authored-by: qti-monumeen <[email protected]>
Co-authored-by: Ankit Maheshkar <[email protected]>
Co-authored-by: Eric Crawford <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: guschmue <[email protected]>
Co-authored-by: Guenther Schmuelling <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: angelser <[email protected]>
Co-authored-by: Angela Serrano Brummett <[email protected]>
Co-authored-by: Misha Chornyi <[email protected]>
Co-authored-by: hariharans29 <[email protected]>
Co-authored-by: eserscor <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Baiju Meswani <[email protected]>
Co-authored-by: Adrian Lizarraga <[email protected]>
Co-authored-by: Ti-Tai Wang <[email protected]>
Co-authored-by: bmehta001 <[email protected]>
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