Describe the issue
Nuget package Microsoft.ML.OnnxRuntime.Gpu 1.20.1 keep publishing DLL files for linux-x64, especially onnxruntime_providers_cuda.dll which is very large (>600MB), these DLL files are unnecessary to linux

Please fix to stop publishing these onnxruntime*.dll files for linux-x64 when dotnet build/dotnet publish, otherwise the final binaries size will be double (both cuda.so and cuda.dll >600MB)
One possible clue: it seems that this file Microsoft.ML.OnnxRuntime.Gpu.Windows.props is trying to copy DLL files for all x64 platforms including linux-x64.

Related issue: microsoft/onnxruntime-genai#1135
Urgency
No response
Target platform
linux-x64
Build script
build linux-x64 under linux command line:
dotnet publish test.csproj --runtime linux-x64
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<IsPackable>false</IsPackable>
<SelfContained>true</SelfContained>
</PropertyGroup>
<!-- OnnxRuntime CUDA https://onnxruntime.ai/docs/get-started/with-csharp.html#builds -->
<ItemGroup>
<PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu" Version="1.20.1" />
</ItemGroup>
</Project>
namespace MyTest;
using Microsoft.ML.OnnxRuntime;
public class Program
{
public static async Task Main(string[] args)
{
const string modelPath = "/home/jiaxuwu/.aitk/models/onnx/cuda/mistral-7b-instruct-v0.2-cuda-int4-rtn-block-32/mistral-7b-instruct-v0.2-cuda-int4-rtn-block-32.onnx";
using var session = new InferenceSession(modelPath);
}
}
Error / output
There are many DLL files in the final binaries
$ ll -h bin/Release/net8/linux-x64/publish/onnxruntime*.dll
... 12M Nov 19 23:09 bin/Release/net8/linux-x64/publish/onnxruntime.dll*
... 643M Nov 19 23:10 bin/Release/net8/linux-x64/publish/onnxruntime_providers_cuda.dll*
... 22K Nov 19 23:10 bin/Release/net8/linux-x64/publish/onnxruntime_providers_shared.dll*
... 744K Nov 19 23:09 bin/Release/net8/linux-x64/publish/onnxruntime_providers_tensorrt.dll*
$ ll -h bin/Release/net8/linux-x64/onnxruntime*.dll
... 12M Nov 19 23:09 bin/Release/net8/linux-x64/onnxruntime.dll*
... 643M Nov 19 23:10 bin/Release/net8/linux-x64/onnxruntime_providers_cuda.dll*
... 22K Nov 19 23:10 bin/Release/net8/linux-x64/onnxruntime_providers_shared.dll*
... 744K Nov 19 23:09 bin/Release/net8/linux-x64/onnxruntime_providers_tensorrt.dll*
Visual Studio Version
No response
GCC / Compiler Version
No response
Describe the issue
Nuget package

Microsoft.ML.OnnxRuntime.Gpu 1.20.1keep publishing DLL files for linux-x64, especiallyonnxruntime_providers_cuda.dllwhich is very large (>600MB), these DLL files are unnecessary to linuxPlease fix to stop publishing these onnxruntime*.dll files for linux-x64 when
dotnet build/dotnet publish, otherwise the final binaries size will be double (both cuda.so and cuda.dll >600MB)One possible clue: it seems that this file

Microsoft.ML.OnnxRuntime.Gpu.Windows.propsis trying to copy DLL files for all x64 platforms including linux-x64.Related issue: microsoft/onnxruntime-genai#1135
Urgency
No response
Target platform
linux-x64
Build script
build linux-x64 under linux command line:
dotnet publish test.csproj --runtime linux-x64test.csprojProgram.csError / output
There are many DLL files in the final binaries
Visual Studio Version
No response
GCC / Compiler Version
No response