I want to launch the xml file from local state folder of my appx. I am unable to launch file using var file= ApplicationData.current.LocalFolder.GetFileAsync();
Launcher.LaunchFileAsync(file)
.Is there any way to launch the file in UWP?
It seems that there is some issue with the default option you open the xml file with. And I have tried to launch a xml file with following code. And it works pretty well. The default application that I used to open xml file was Microsoft Edge.
string xmlFile = @"TextFile.xml";
var file = await ApplicationData.Current.LocalFolder.GetFileAsync(xmlFile);
if (file != null)
{
var success = await Launcher.LaunchFileAsync(file);
if (success)
{
// File launched
}
else
{
// File launch failed
}
}
else
{
// Could not find file
}
Please try to change the default apps to load xml file normally.