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?
If you want to open a UWP app, you can go through the Start Menu, the apps list in the Start menu, you can create a desktop shortcut for them, or add them to the start up folder. If you want to open UWP apps from the command line on Windows, you can.
Microsoft continues to baby-step around the obvious, but it has officially deprecated the Universal Windows Platform (UWP) as it pushes the desktop-focused Windows App SDK (formerly called Project Reunion) and WinUI 3 as the future of Windows application development.
Press Ctrl+P. Now the default launch action for the file will be execute. If it is a mp3 or avi file it will be played by the default player for that file type, If it is a exe file it will start that program. It will do all this without you having to browse into the folder and launch the file yourself.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With