Add/Update a non-Store published Optional Package from code

%3CLINGO-SUB%20id%3D%22lingo-sub-1657259%22%20slang%3D%22en-US%22%3EAdd%2FUpdate%20a%20non-Store%20published%20Optional%20Package%20from%20code%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1657259%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20have%20a%20question%20regarding%20the%20add%2Fupdate%20of%20a%20non-Store%20published%20Optional%20Package%20from%20code.%3CBR%20%2F%3EIn%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fmsix%2Fnon-store-developer-updates%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Edocumenation%2C%3C%2FA%3E%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fuwp%2Fapi%2Fwindows.management.deployment.packagemanager.addpackageasync%3Fview%3Dwinrt-19041%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAddPackageAsync%3C%2FA%3E%20API%2C%20seems%20to%20be%20the%20way%20to%20add%2Fupdate%20a%20package%20from%20code.%3CBR%20%2F%3EMy%20question%20is%20-%20how%20can%20I%20add%2Fupdate%20an%20Optional%20Package%20from%20code%20%3F%20From%20documentation%2C%20AddPackageAsync%20method%20seems%20to%20work%20only%20with%20main%20packages.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20!%3C%2FP%3E%3CP%3EVictor%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1665776%22%20slang%3D%22en-US%22%3ERe%3A%20Add%2FUpdate%20a%20non-Store%20published%20Optional%20Package%20from%20code%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1665776%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F230350%22%20target%3D%22_blank%22%3E%40Victor%20Vica%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAddPackageAsync%20should%20work%20to%20install%20an%20optional%20package%20as%20long%20as%20the%20main%20package%20is%20already%20installed%20on%20the%20device.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20seeing%20an%20error%2C%20please%20share%20the%20error%20message%20for%20us%20to%20review.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks!%3CBR%20%2F%3EJames%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi,

I have a question regarding the add/update of a non-Store published Optional Package from code.
In the documenation, AddPackageAsync API, seems to be the way to add/update a package from code.
My question is - how can I add/update an Optional Package from code ? From documentation, AddPackageAsync method seems to work only with main packages.

 

Thanks !

Victor

2 Replies
Microsoft Verified Best Answer

Hi @Victor Vica ,

 

AddPackageAsync should work to install an optional package as long as the main package is already installed on the device.

 

If you are seeing an error, please share the error message for us to review.

 

Thanks!
James

Hi, @James Pike 

 

Thanks for your reply. I will try it as you adviced and keep you posted.

 

Victor