In some cases, you might want finer-grained control over the debugging process, including the ability to debug your application before it starts.
If you make your changes to your application to fix bugs, repackage it by using the MakeAppx tool. Modify your application in between debug sessions In the Installed App Packages list, select your app package, and then choose the Attach button. In Visual Studio, choose Debug-> Other Debug Targets-> Debug Installed App Package. If you want to debug your application with elevated permissions, start Visual Studio by using the Run as Administrator option. Make sure that you start your packaged application at least one time so that it's installed on your local machine. If you created your package using any other tool, follow these steps:
If you created your package by using the new packaging project available in Visual Studio 2017 version 15.4 and later (including Visual Studio 2019), just set the packaging project as the startup project, and then press F5 to debug your app. How you debug the application depends on what tool you used to create the package. A packaged application always runs as an interactive user, and any drive that you install your packaged application on to must be formatted to NTFS format.