[Build] Not able to build ONNX Runtime Nuget package on Windows #23321
Labels
api:CSharp
issues related to the C# API
build
build issues; typically submitted using template
.NET
Pull requests that update .net code
platform:windows
issues related to the Windows platform
Describe the issue
Trying to build ORT nuget package but not working.
Already has:
Visual studio 2022
cmake version 3.31.2
dotnet --version 9.0.100 (Install with visual studio 2022)
nuget.exe v6.12.2 from https://www.nuget.org/downloads and added file path in System Path Env settings
Script was excuted from either cmd or Developer Command Prompt for VS 2022, but same error
Urgency
No response
Target platform
Windows 11 24H2
Build script
.\build.bat --config Release --build_shared_lib --build_nuget --cmake_generator "Visual Studio 17 2022" --skip_test --msbuild_extra_options IncludeMobileTargets=false
Error / output
2025-01-10 11:55:54,717 build [INFO] - dotnet restore OnnxRuntime.DesktopOnly.CSharp.sln --configfile NuGet.CSharp.config /p:IncludeMobileTargets=false
Restore complete (0.5s)
Build succeeded in 0.6s
2025-01-10 11:55:55,516 build [INFO] - dotnet msbuild OnnxRuntime.DesktopOnly.CSharp.sln /p:Configuration=Release /p:OrtPackageId=Microsoft.ML.OnnxRuntime /p:OnnxRuntimeBuildDirectory=D:\ONNX\onnxruntime\build\Windows /p:TrainingEnabledNativeBuild=false /p:IncludeMobileTargets=false
Microsoft.ML.OnnxRuntime net8.0 succeeded (0.1s) → src\Microsoft.ML.OnnxRuntime\bin\Release\net8.0\Microsoft.ML.OnnxRuntime.dll
Microsoft.ML.OnnxRuntime netstandard2.0 succeeded (0.1s) → src\Microsoft.ML.OnnxRuntime\bin\Release\netstandard2.0\Microsoft.ML.OnnxRuntime.dll
Microsoft.ML.OnnxRuntime.InferenceSample succeeded (0.1s) → sample\InferenceSample\Microsoft.ML.OnnxRuntime.InferenceSample\bin\Release\netstandard2.0\Microsoft.ML.OnnxRuntime.InferenceSample.dll
Microsoft.ML.OnnxRuntime.Tests.Common netstandard2.0 succeeded (0.1s) → test\Microsoft.ML.OnnxRuntime.Tests.Common\bin\Release\netstandard2.0\Microsoft.ML.OnnxRuntime.Tests.Common.dll
Microsoft.ML.OnnxRuntime.PerfTool succeeded (0.1s) → tools\Microsoft.ML.OnnxRuntime.PerfTool\bin\Release\net8.0\Microsoft.ML.OnnxRuntime.PerfTool.dll
Microsoft.ML.OnnxRuntime.Tests.Common net8.0 succeeded (0.1s) → test\Microsoft.ML.OnnxRuntime.Tests.Common\bin\Release\net8.0\Microsoft.ML.OnnxRuntime.Tests.Common.dll
Microsoft.ML.OnnxRuntime.InferenceSample.NetCoreApp succeeded (0.1s) → sample\InferenceSample\Microsoft.ML.OnnxRuntime.InferenceSample.NetCoreApp\bin\Release\net8.0\Microsoft.ML.OnnxRuntime.InferenceSample.NetCoreApp.dll
Microsoft.ML.OnnxRuntime.Tests.NetCoreApp succeeded (0.1s) → test\Microsoft.ML.OnnxRuntime.Tests.NetCoreApp\bin\Release\net8.0\Microsoft.ML.OnnxRuntime.Tests.NetCoreApp.dll
Build succeeded in 0.8s
2025-01-10 11:55:56,530 build [INFO] - dotnet msbuild OnnxRuntime.CSharp.proj /t:CreatePackage /p:OrtPackageId=Microsoft.ML.OnnxRuntime /p:Configuration=Release /p:ExecutionProvider=None /p:OnnxRuntimeBuildDirectory=D:\ONNX\onnxruntime\build\Windows /p:NugetExe="nuget.exe" /p:IncludeMobileTargets=false
OnnxRuntime.CSharp failed with 1 error(s) (0.3s)
D:\ONNX\onnxruntime\csharp\OnnxRuntime.CSharp.proj(109,5): error MSB3073: The command "nuget.exe pack NativeNuget.nuspec" exited with code 9009.
Build failed with 1 error(s) in 1.3s
Traceback (most recent call last):
File "D:\ONNX\onnxruntime\tools\ci_build\build.py", line 2964, in
sys.exit(main())
^^^^^^
File "D:\ONNX\onnxruntime\tools\ci_build\build.py", line 2915, in main
build_nuget_package(
File "D:\ONNX\onnxruntime\tools\ci_build\build.py", line 2439, in build_nuget_package
run_subprocess(cmd_args, cwd=csharp_build_dir)
File "D:\ONNX\onnxruntime\tools\ci_build\build.py", line 868, in run_subprocess
return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ONNX\onnxruntime\tools\python\util\run.py", line 49, in run
completed_process = subprocess.run(
^^^^^^^^^^^^^^^
File "C:\Users\louieniu\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['dotnet', 'msbuild', 'OnnxRuntime.CSharp.proj', '/t:CreatePackage', '/p:OrtPackageId=Microsoft.ML.OnnxRuntime', '/p:Configuration=Release', '/p:ExecutionProvider=None', '/p:OnnxRuntimeBuildDirectory=D:\ONNX\onnxruntime\build\Windows', '/p:NugetExe="nuget.exe"', '/p:IncludeMobileTargets=false']' returned non-zero exit status 1.
Visual Studio Version
No response
GCC / Compiler Version
No response
The text was updated successfully, but these errors were encountered: