microsoft / onnxruntime-genai

Generative AI extensions for onnxruntime
MIT License
417 stars 94 forks source link

Can't use this lib and the non-genai version of the onnxruntime in the same MSIX project. #332

Closed azchohfi closed 3 months ago

azchohfi commented 4 months ago

If you have a project referencing both the onnxruntime and the genai package, and if I try to build a windows app (WinAppSDK), it fails:

<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.17.3" />
<PackageReference Include="Microsoft.ML.OnnxRuntimeGenAI.DirectML" Version="0.2.0-rc4" />
1>C:\Users\alzollin\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\Microsoft.Build.Msix.Packaging.targets(1515,5): error APPX1101: Payload contains two or more files with the same destination path 'DirectML.dll'. Source files: 
1>C:\Users\alzollin\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\Microsoft.Build.Msix.Packaging.targets(1515,5): error APPX1101: C:\Users\alzollin\.nuget\packages\microsoft.ml.onnxruntimegenai.directml\0.2.0-rc4\runtimes\win-x64\native\DirectML.dll
1>C:\Users\alzollin\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\Microsoft.Build.Msix.Packaging.targets(1515,5): error APPX1101: C:\Users\alzollin\.nuget\packages\microsoft.ai.directml\1.13.1\bin\x64-win\DirectML.dll
1>C:\Users\alzollin\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\Microsoft.Build.Msix.Packaging.targets(1515,5): error APPX1101: Payload contains two or more files with the same destination path 'onnxruntime.dll'. Source files: 
1>C:\Users\alzollin\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\Microsoft.Build.Msix.Packaging.targets(1515,5): error APPX1101: C:\Users\alzollin\.nuget\packages\microsoft.ml.onnxruntimegenai.directml\0.2.0-rc4\runtimes\win-x64\native\onnxruntime.dll
1>C:\Users\alzollin\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\Microsoft.Build.Msix.Packaging.targets(1515,5): error APPX1101: C:\Users\alzollin\.nuget\packages\microsoft.ml.onnxruntime.directml\1.17.3\runtimes\win-x64\native\onnxruntime.dll
azchohfi commented 4 months ago

A workaround is to remove one of them:

<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.17.3" PrivateAssets="contentfiles;analyzers" ExcludeAssets="build" />
baijumeswani commented 4 months ago

Thanks for reporting this. We are trying to come up with a solution that will resolve this problem. We are probably going to target a solution for a future release (not 0.2.0).

azchohfi commented 4 months ago

I see the PR is out. Is this still not for 0.2.0? I believe it would need cherry-picking, but maybe this is too much breaking of a change that you want it for later?

baijumeswani commented 4 months ago

This would impact 0.2.0 dml variant if we cherry picked it since ort has changes not currently released in a stable nuget. We probably will not be adding it to 0.2.0.

Does the problem also manifest in a console application? I was not able to reproduce this there. Maybe it only happens with WinAppSDK?

azchohfi commented 4 months ago

I see. No problem. I believe it replicates in any packaged (MSIX) app, not necessarily WinAppSDK.

natke commented 3 months ago

Closing this for now. We have an ongoing effort to resolve the inclusion of ONNXR Runtime nugets in this library