WindowsAppSDK
WindowsAppSDK copied to clipboard
launchSettings.json is used for both per-user and per-project configuration
Describe the bug
launchSettings.json contains key WinAppSdk project configuration in the current templates, and if the file is missing things break. It must be checked in. But launchSettings.json also contains user-specific configuration such as the target machine for remote deploy/debug scenarios. Those ideally shouldn't be checked in.
Steps to reproduce the bug
- Create a WinAppSdk project
- Delete launchSettings.json (simulating it being ignored by .gitignore)
- Try to build and run the app
Or alternatively, if you do put launchSettings.json under source control:
- Configure a remote machine to test your WinAppSdk app on.
- Look at the git diff for launchSettings.json. Details specific to your remote machine are now in the file, and you need to be careful to exclude them from any future commits.
Expected behavior
No response
Screenshots
No response
NuGet package version
1.1.2
Packaging type
Packaged (MSIX)
Windows version
Insider Build (xxxxx)
IDE
Visual Studio 2022
Additional context
I'm not familiar with everything launchSettings.json can do, but at least some of its configuration is user-specific stuff. In particular, when I configured a remote machine to deploy/test on, the details of which machine to connect to and which authentication mode to use ended up in launchSettings.json. In that respect, you don't want launchSettings.json to be part of the checked-in code for a WinAppSDK project, because different users will want to F5 the app in different ways.
But launchSettings.json is also responsible for configuring the (Package) and (Unpackaged) profiles (specifically, setting commandName to either "MsixPackage" or "Project"). And if that configuration is absent, you can't actually build the project from scratch. I actually stumbled into this issue because the brand new Azure DevOps repo we configured (in a Microsoft-internal project; not sure if it's standard) came with a .gitignore that excluded launchSettings.json from source control. A coworker set up the repo and the WinAppSdk project, and when I pulled it down and tried to build it, F5 failed because it couldn't find Microsoft.UI.XAML.dll. I dug a bit deeper, and saw that the WinAppSdk framework package wasn't even getting deployed as part of F5. I ultimately had to pull in a WinAppSdk dev to figure out that the issue was that launchSettings.json was being excluded from source control, so the project's configuration was incomplete.
Not 100% sure this problem is tractable. It would probably require some alternative place to put the Packaged/Unpackaged toggle that WinAppSdk templates currently store in launchSettings.json, so that the file could be used solely for user config. This could arguably be viewed as a VS bug, in that they should give some way to implement this configuration without mixing user/project state in the same file.