Forum Discussion
Creating Optional package without Visual Studio
Yes optional packages can be created with MakeAppx directly. I recommend you to take a look at the packaging layout (used with MakeAppx) that can help you create your main package and optional packages easily: https://docs.microsoft.com/en-us/windows/uwp/packaging/packaging-layout
Are you looking to create optional packages that only contain assets or would they contain code to be loaded by the main package (ie a related set)?
If it's the latter, then all you need to do is provide an appropriately specified AppxManifest.xml to the ManifestPath of your optional package in the packaging layout. Take a look at steps 3 and 4 of this blog post for how to mark a manifest for an optional package: https://blogs.msdn.microsoft.com/appinstaller/2017/05/09/build-your-first-optional-package/
If it's the former, then in addition to the steps above, you should set the "RelatedSet" attribute of your optional package to be "false" in the packaging layout.
- Ryan EadieNov 07, 2018Copper Contributor
Maybe I'm misunderstanding the purpose of Optional Packages and Related sets. I have a Win32 exe that can use optional dlls, which are distributed separately from the exe. The files need to be in the same folder as the main application (so LoadLibrary can find the files). Is this possible with an Optional Package or Related Set?
- Andy LiuNov 07, 2018
Microsoft
Is your Win32 exe also packaged? If it is then yes this is possible with related set, your main app can use LoadPackagedLibrary to load the dlls in an optional package (main apps and optional packages are deployed to separate directories, but LoadPackagedLibrary should be able to find the dlls for you).
If your Win32 exe is not packaged, then optional packages won't work for you. Optional packages are not designed to be used stand-alone with an unpackaged Win32 app.
- Ryan EadieNov 07, 2018Copper Contributor
Yes, the Win32 exe is also packaged. Does this mean I have to change all instances of LoadLibrary to LoadPackagedLibrary? How do I handle statically linked delay loaded dlls that are optionally installed?