Finding out installed Metro applications on a machine

安稳与你 提交于 2019-12-04 07:03:37

I wish I could comment...Is this an option?

IEnumerable<Windows.ApplicationModel.Package> packages = 
        (IEnumerable<Windows.ApplicationModel.Package>)packageManager.FindPackagesForUser("");

http://msdn.microsoft.com/en-us/library/windows/apps/windows.management.deployment.packagemanager.aspx

Thanks everyone! For the PackageManager code to work, I had to do the following

1) Add the following to .csproj.

 <PropertyGroup>
   <TargetPlatformVersion>8.0</TargetPlatformVersion>
 </PropertyGroup>
 <Reference Include="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

2) Add a reference to C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral\Windows.winmd

After doing the above, I was able to list all the metro packages.

You can't iterate through all packages installed in PC in WinRT app. It's possible in desktop and console app. See these MSDN threads for more info.

How to get all Metro apps list in Metro App?

How do I get all Metro style apps list in my Metro App?

To perform the same here's code.

If anyone's wondering how to get the packageManager variable in the accepted answer you need to do the following:

Windows.Management.Deployment.PackageManager packageManager = new Windows.Management.Deployment.PackageManager();

I guess this belongs to a comment, but I don't have enough reputation, sorry.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!