Repair the VS Code launch configurations - #38
Merged
Conversation
Two of the seven configurations named AspNetCore3Example and AspNetCore3ChildLifetimeScope, projects deleted some time ago, and the rest pointed at bin/Debug/net6.0 or netcoreapp3.1 paths for projects that target net10.0. Nothing in the file could start. AspNetCoreChildLifetimeScope and AspNetCoreNoStartupExample had no configuration at all despite being runnable. Environment variables now come from each project's launchSettings.json via launchSettingsProfile rather than an inline env block, so there is one place to change them instead of two that can disagree. The ASP.NET Core profiles use DOTNET_ENVIRONMENT; the .NET Framework ones are left alone because classic ASP.NET reads neither prefix and their entries are inert VS boilerplate. Also drops a sourceFileMap pointing at a Views folder that does not exist at the workspace root, the omnisharp settings the Roslyn language server ignores, and a test explorer recommendation for a repo with no tests. Adds dotnet.defaultSolution so the C# extension stops asking which solution to load. Part of #32
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #32
Proposed Changes
launch.jsoncould not start anything. Two of its seven configurations namedAspNetCore3ExampleandAspNetCore3ChildLifetimeScope, projects deleted some time ago, and every surviving one pointed at abin/Debug/net6.0ornetcoreapp3.1path for a project that targetsnet10.0. MeanwhileAspNetCoreChildLifetimeScopeandAspNetCoreNoStartupExampleare runnable and had no configuration at all. There are now seven configurations, one per launchablenet10.0project, with correct paths.launchSettings.json, referenced vialaunchSettingsProfile. All three ASP.NET Core projects already had alaunchSettings.jsonsetting the same variable, solaunch.jsonhad been carrying a duplicate copy — in the file that also had the wrong paths. One source now instead of two that can disagree.DOTNET_ENVIRONMENTreplacesASPNETCORE_ENVIRONMENTin those three profiles. The five .NET Framework projects keep theirs: classic ASP.NET reads neither prefix, so those entries are inert VS boilerplate and changing them would imply a behavior difference that doesn't exist.sourceFileMapfor${workspaceFolder}/Views. No such folder exists; the onlyViewsdirectories belong to the net481 MVC projects, which aren't inlaunch.json.omnisharp.*settings. The C# extension uses the Roslyn language server now and ignores them.extensions.jsonfor a repo with no tests.dotnet.defaultSolutionso the C# extension stops asking which solution to load.Verification
I validated every configuration programmatically rather than by eye — each one names a real project, its
programfile exists on disk and sits under thecwdit declares, itslaunchSettingsProfileresolves to a profile that actually exists, and no configuration retains an inlineenv, a stale TFM, or asourceFileMap. The check also runs in reverse: every launchablenet10.0project has a configuration, and no configuration names a project that doesn't exist. Seven for seven, no gaps either direction.For the profile mechanism itself I ran
AspNetCoreChildLifetimeScopethrough its launch profile withDOTNET_ENVIRONMENTandASPNETCORE_ENVIRONMENTboth cleared from the shell, and it reportedHosting environment: Developmentwith both endpoints serving. So the variable really is coming from the profile. The other two profiles are structurally identical; I checked those by structure rather than launching them, since their profiles setlaunchBrowser: trueand I didn't want to pop browsers open.Before that I confirmed
DOTNET_ENVIRONMENTis honoured by these apps at all, since the ASP.NET Core templates emit theASPNETCORE_form — both set the environment, so the switch is safe.Not included
The six .NET Framework projects have no launch configuration. The five web ones need IIS Express, and
WebApiExample.OwinSelfHostis a self-host exe that needs the Windows-onlyclrdebugger rather thancoreclr. I left them out rather than add configurations that fail confusingly on macOS and Linux, but say the word and I'll add aclrconfiguration for the self-host example.