Creating Optional package without Visual Studio

Copper Contributor

The documentation and sample for creating optional packages uses Visual Studio.  Can Optional packages be created without Visual Studio, similar to creating a bundle using makeappx?


5 Replies

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:

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:

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. 


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?

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. 

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?

Yes you should be using LoadPackagedLibrary, and statically linked delay loaded dlls should work the same way that they do for a main package. Let me know if you're having any issues with these.