Forum Discussion
Sep 28, 2022
Shared Package Container and AppModel API
The PSF uses the AppModel API (appmodel.h and kernel.appcore.dll) to obtain information about the currently executing package it is in.
In a scenario with SPC, there are multiple packages, and ...
Aditi_Narvekar
Microsoft
Oct 04, 2022TIMOTHY_MANGAN There is an API for that yes SharedPackageContainerManager Class (Windows.Management.Deployment) - Windows UWP applications | Microsoft Learn
One of our engineers has shared a snipped of code that might help get you started
TEST_METHOD(GetContainer)
{
auto id = CreatSimpleContainer(L"container", {
L"family1_8wekyb3d8bbwe",
L"family2_8wekyb3d8bbwe"
}).Id();
auto manager = winrt::SharedPackageContainerManager::GetDefault();
// Get container
auto container = manager.GetContainer(id);
log(L"Container name: ", container.Name().c_str());
log(L"Container id: ", container.Id().c_str());
VERIFY_ARE_EQUAL(container.Name(), L"container");
VERIFY_ARE_EQUAL(container.Id().size(), 36u);
auto members = container.GetMembers();
VERIFY_ARE_EQUAL(members.Size(), 2u);
VERIFY_ARE_EQUAL(members.GetAt(0).PackageFamilyName(), L"family1_8wekyb3d8bbwe");
VERIFY_ARE_EQUAL(members.GetAt(1).PackageFamilyName(), L"family2_8wekyb3d8bbwe");
}
- Oct 08, 2022
Aditi_Narvekar Thank you. I was hoping to access the API from C++ (to be added as part of the Package Support Framework, which currently doesn't support Shared Package Groups when software in multiple packages needs the PSF in an MSIX package). Is there any chance of a non-UWP API out there?
Regards,
Tim