Forum Discussion
Msix : how to load DLL from other msix package.
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.
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
- Dooyoul ChungNov 02, 2018Copper Contributor
Thanks Andy,
Now, "Optional package" works as expected. The issue caused converting MSI to MSIX with "Msix Packaging Tool" with defining below Install Location. If I define install location as "C:\Program Files\MsixPrototype" then MSIX generated under [ROOT]\Program Files instead of [ROOT]\VFS\ProgramFilesX64\ which caused problem to loading optional package.
Once change package location under [ROOT]\VFS\ProgramFilesX64\MsixPrototype\mainapp.exe
and "Optional Package" as [ROOT]\VFS\ProgramFielsX64\MsixPrototype\mainappres.dll
all worked well with LoadLibraryEx( ).
Suggestion is remove "Install location" from "MSIX Packaging Tool" UI _or_ adding description to avoid confusion.
Thanks all.