Closed jtsom closed 1 year ago
The Debug Button in the file toobar will try to find the project that compiles this file.
It will be different than what F5 (Start Debugging) will do because that will launch the current selected debug configuration.
For example, if you have a Solution with two console projects (Project A and Project B), if you have a Debug Configuration for Project A, but have the cs file open for Project B.
F5 will debug Project A but the debug file button will launch Project B.
Other Extensions such as Python will try to execute the current file, as .NET is project system based, we will have to assoicate the file with the project. If the file has multiple associations it should prompt which project you want to launch.
The C# SDK needs an option, similar to Visual Studio, where the user can assign the default startup project "Set As Startup Project", so when clicking that Run button, the correct project will be launched (ie. the Web API, or Web UI project, as opposed to some library project in the solution.)
I will be closing this issue as a dupliate of https://github.com/microsoft/vscode-dotnettools/issues/72 as it seems you are looking for a Launch Startup Project experience.
Feel free to re-open if I am incorrect.
@WardenGnaw It's not so much asking specifically for the Launch Startup Project, but that the current button / functionality does not work.
If the active editor window is NOT the project that is to be launched, there will be an ERROR. It took me a while to figure out why I was getting the error. It should do the SAME thing as the current F5 / Run button in the Debug tab - not throw an error.
Dear @WardenGnaw,
About your mention of
> The Debug Button in the file toobar will try to find the project that compiles this file.
Respectfully, how can I make the functionality of this button into a shortcut such that it works?
FYI: Currently I have assigned a shortcut to this functionality and the shortcut is displayed while hovering the button but it throws an error when the shortcut is used. However, when the corresponding button is pressed everything works as intended. (There is no "When" clause defined in the shortcut.) ERROR: "No C# project is currently loaded. Please create a C# project in order to debug." "Source: C# Dev Kit"
P.S. I did read #318 but the information shared there does not contribute to a solution to the context above mentioned.
Type: Bug
Issue Description
In a multi-project solution, if the currently active file in the editor is NOT in the "start up" project (Web app, web api, etc.), clicking the Run button in the top right of the window:
does not start up the project. An error is generated and shown in a popup notification:
NOTE: Hitting the F5 Key WILL launch the application properly, no matter what editor window is active. As will the Run button in the Run and Debug pane:
Steps to Reproduce
In a multi project application, ie. one project is a Web Api, another project is a Services project, another is a Data Access project, have as the current active editor a file in any project that is NOT the Web Api project. Click the Run button at the top.
Expected Behavior
Project launches the appropriate Web Api project (in this case)
Actual Behavior
Error notification as shown above
Logs
C# log
C# LSP Trace Logs
Environment information
VSCode version: 1.84.0-insider C# Extension: 2.6.24 Using OmniSharp: false
Dotnet Information
.NET SDK: Version: 8.0.100-rc.2.23502.2 Commit: 0abacfc2b6 Runtime Environment: OS Name: Windows OS Version: 10.0.22621 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.100-rc.2.23502.2\ .NET workloads installed: There are no installed workloads to display. Host: Version: 8.0.0-rc.2.23479.6 Architecture: x64 Commit: 0b25e38ad3 .NET SDKs installed: 3.1.426 [C:\Program Files\dotnet\sdk] 5.0.408 [C:\Program Files\dotnet\sdk] 6.0.123 [C:\Program Files\dotnet\sdk] 6.0.318 [C:\Program Files\dotnet\sdk] 6.0.415 [C:\Program Files\dotnet\sdk] 7.0.112 [C:\Program Files\dotnet\sdk] 7.0.203 [C:\Program Files\dotnet\sdk] 7.0.309 [C:\Program Files\dotnet\sdk] 7.0.402 [C:\Program Files\dotnet\sdk] 8.0.100-rc.2.23502.2 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0-rc.2.23480.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0-rc.2.23479.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0-rc.2.23479.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/downloadVisual Studio Code Extensions
|Extension|Author|Version|Folder Name| |---|---|---|---| |azure-account|ms-vscode|0.11.6|ms-vscode.azure-account-0.11.6| |csdevkit|ms-dotnettools|0.6.3|ms-dotnettools.csdevkit-0.6.3-win32-x64| |csharp|ms-dotnettools|2.6.24|ms-dotnettools.csharp-2.6.24-win32-x64| |csharpextensions|kreativ-software|1.7.3|kreativ-software.csharpextensions-1.7.3| |ecdc|mitchdenny|1.8.0|mitchdenny.ecdc-1.8.0| |git-graph|mhutchie|1.30.0|mhutchie.git-graph-1.30.0| |hexeditor|ms-vscode|1.9.12|ms-vscode.hexeditor-1.9.12| |hl7tools|RobHolme|2.0.4|robholme.hl7tools-2.0.4| |jwt-debugger|yokawasa|0.4.2|yokawasa.jwt-debugger-0.4.2| |kanagawa|qufiwefefwoyn|1.5.1|qufiwefefwoyn.kanagawa-1.5.1| |live-server|ms-vscode|0.4.11|ms-vscode.live-server-0.4.11| |material-icon-theme|PKief|4.31.0|pkief.material-icon-theme-4.31.0| |msbuild-project-tools|tintoy|0.4.9|tintoy.msbuild-project-tools-0.4.9| |night-owl|sdras|2.0.1|sdras.night-owl-2.0.1| |quicktype|quicktype|12.0.46|quicktype.quicktype-12.0.46| |rainbow-csv|mechatroner|3.7.1|mechatroner.rainbow-csv-3.7.1| |sync-scroll|dqisme|1.3.1|dqisme.sync-scroll-1.3.1| |TabOut|albert|0.2.2|albert.tabout-0.2.2| |vs-code-xml-format|fabianlauer|0.1.5|fabianlauer.vs-code-xml-format-0.1.5| |vscode-azureappservice|ms-azuretools|0.25.1|ms-azuretools.vscode-azureappservice-0.25.1| |vscode-azurefunctions|ms-azuretools|1.13.1|ms-azuretools.vscode-azurefunctions-1.13.1| |vscode-azureresourcegroups|ms-azuretools|0.7.5|ms-azuretools.vscode-azureresourcegroups-0.7.5| |vscode-azurestorage|ms-azuretools|0.15.3|ms-azuretools.vscode-azurestorage-0.15.3| |vscode-base64|adamhartford|0.1.0|adamhartford.vscode-base64-0.1.0| |vscode-cosmosdb|ms-azuretools|0.20.0|ms-azuretools.vscode-cosmosdb-0.20.0| |vscode-dotnet-runtime|ms-dotnettools|1.8.1|ms-dotnettools.vscode-dotnet-runtime-1.8.1| |vscode-thunder-client|rangav|2.13.5|rangav.vscode-thunder-client-2.13.5| |vscodeintellicode|VisualStudioExptTeam|1.2.30|visualstudioexptteam.vscodeintellicode-1.2.30| |vscodeintellicode-csharp|ms-dotnettools|0.1.26|ms-dotnettools.vscodeintellicode-csharp-0.1.26-win32-x64|;Extension version: 0.6.3 VS Code version: Code - Insiders 1.84.0-insider (58bdf2c7c40be6f4494ae35a09528708832cf357, 2023-10-18T05:50:15.982Z) OS version: Windows_NT x64 10.0.22621 Modes:
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz (6 x 3000)| |GPU Status|2d_canvas: enabledcanvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.78GB (11.14GB free)| |Process Argv|--crash-reporter-id 362817d9-b661-4b35-92b7-fe18e5872851| |Screen Reader|no| |VM|0%|
A/B Experiments
``` vsliv695:30137379 vsins829:30139715 vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256198 vslsvsres303:30308271 pythontb:30258533 pythonptprofiler:30281269 vshan820:30294714 vscod805cf:30301675 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30404738 py29gd2263:30784851 vsclangdf:30492506 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30618038 vscrp:30624060 a9j8j154:30646983 showlangstatbar:30737417 ecj1e332:30687743 pythonfmttext:30716741 fixshowwlkth:30771523 showindicator:30805243 pythongtdpath:30726887 i26e3531:30792625 welcomedialog:30812478 pythonnosmt12:30779711 pythonidxpt:30768918 pythonnoceb:30776497 copilotsettingt:30808721 dsvsc013:30777762 dsvsc014:30777825 diffeditorv2:30786206 pythonmpsinfo:30859869 dsvsc015:30821418 pythontestfixt:30859590 pythonmypyd1:30859725 pythoncet0:30859736 pythontbext0:30864172 ```