theNoob
theNoob

Reputation: 181

UWP - Reading the windows protocol value in the Package.appxmanifest programmatically

Im trying to access my appManifest file programmatically in my windows universal platform app.

I need to read the value under windows protocol extension.

any one has done anything similar?

Upvotes: 1

Views: 651

Answers (1)

Xie Steven
Xie Steven

Reputation: 8591

The 'Package.appxmanifest' file is in the Application install directory. You could use the Storage relevant APIs to get it. For example:

var file = await Package.Current.InstalledLocation.GetFileAsync("AppxManifest.XML");

Please note that the files in Application install directory are read-only. You could only read it, not writable.

After get the 'AppxManifest.XML' file, you could use System.Xml relevant APIs to get the specific node.

var file = await Package.Current.InstalledLocation.GetFileAsync("AppxManifest.XML");
using (Stream stream = await file.OpenStreamForReadAsync())
{
    var doc = XDocument.Load(stream);
    //...
}

Upvotes: 1

Related Questions