Forum Discussion
Msix : how to load DLL from other msix package.
There is a good MS documentation about msix extension.
https://docs.microsoft.com/en-us/windows/uwp/launch-resume/extend-your-app-with-services-extensions-packages?context=/windows/msix/render
However, still challenge to figure out how to load C++ DLL that installed with "optional package".
For example, I have mainapp.msix(mainapp.exe) and en-us.msix (which contains en-us\mainappres.dll) those are installed unique container under WindowsApps. Is there any msix configuration supported to load en-us\mainappres.dll from mainapp.exe LoadlibraryEX()?
Found that "Optional package" samples https://github.com/AppInstaller/OptionalPackageSample. Which shows load optional DLL. Is that means traditional LoadlibraryEX() won't able to load resource DLL that installed from additional language pack Msix?
I've tried with resource DLL MSIX with set MainPackageDependency but still no luck.
Any suggestions and/or ideas? or this is _not_ supported.
Regards,
6 Replies
- Andy LiuFormer Employee
Are you modeling the en-us.msix as an optional package or as a language resource pack?
You can only load dlls from optional packages, not language resource packs, if your dll is currently contained in a resource pack then you should move it to be part of the main package or change the resource pack to be an optional package.
If you are already using it as an optional package, then can you try using LoadPackagedLibrary (showed in the sample)?
- Dooyoul ChungCopper Contributor
Hi Andy,
Thanks for reply. I've set en-us.msix as an optional package.
I've switch from LoadLibraryEx() to LoadPackagedLibrary() but still does not working.
If I set en-us.msix as "Framework" and set <PackageDependency> from mainapp.msix then I can load mainappres.dll from mainapp.exe. However the en-us.msix is an option package of mainapp.msix not a "Framework".
Is there other way of I can define appmanifest.xml either mainapp.msix or en-us.msix can load DLL the same way as en-us.msix defined with "Framework".
Thanks for sharing your suggestion.- Andy LiuFormer Employee
With regards to loading the mainappres.dll, can you try making the en-us.msix optional package to be in a related set with the mainapp.msix, and also make sure mainappres.dll is in the root of en-us.msix when you are using LoadPackagedLibrary? Related set documentation for working within Visual Studio is here: https://docs.microsoft.com/en-us/windows/uwp/packaging/optional-packages
If you are not using Visual Studio, you can create the related set manually by bundling the mainapp.msix into an .msixbundle, with the AppxBundleManifest.xml containing a pointer to the en-us.msix. The documentation for how to do this is here: https://blogs.msdn.microsoft.com/appinstaller/2017/05/12/tooling-to-create-a-related-set/
Let me know if this works for you.
Andy