Get your App Package Family Name

In this blog, i’ll show you how to get you App PackageFamilyName in Windows 10 in C# Code without Store, because it’s not available yet for Windows 10 

Before:

In Windows and Windows Phone, we used to get App PackageFamilyName from the Store by “Associating the App, and get the unique PFN of the App”

Why do i need PFN:

If you are intending to use communication between Apps, or using App Services, you’ll absolutely need the PFN to connect the App and Service you are using or whatever the scenario you are building.

Let’s Get Started:

  1. Open Visual Studio 2015 CTP, Create new project, select Windows 10 (Blank Template)
  2. Open MainPage.xaml.cs and these namespaces.
    using Windows.ApplicationModel;
    using Windows.UI.Popups;
    

    The first, because we will be using a class inside it called Package
    and the second, to show MessageDialog.

  3. Then, in Public MainPage() add this code.
    var currentPack = Package.Current;
    var pfn = currentPack.Id.FamilyName;
    new MessageDialog("PFN = " + pfn).ShowAsync();
    

    This code to show the PFN in a Message Dialog using Package Class.

  4. Now, run the demo, and the PFN should appear in a Message Dialog as shown:
    pfn

Now, you have got your App PFN, you can use it to connect to other App using App Services.
Here’s the Code Sample.
Feel free to contact me, if you face any problem.