C
C#3w ago
Foomf

I made a new project with "dotnet new" and VS Code already doesn't understand the project structure.

I did dotnet new -n MyApp, cd'd into the directory, and did dotnet build and dotnet run to make sure everything is working correctly. It builds and runs fine, as expected. Opening the folder in vs code, and it can't generate a launch.json at all. Here's a link to the code, does your VS Code know how to make a launchjson? https://github.com/MrZoraman/MyApp I've let VS Code generate tons of launch.json files and it usually figures out all the stuff on its own. I feel like I'm having a stroke here, why all of the sudden is VS Code only able to generate this?:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}
Thanks for any and all help!
GitHub
GitHub - MrZoraman/MyApp
Contribute to MrZoraman/MyApp development by creating an account on GitHub.
25 Replies
Foomf
FoomfOP3w ago
I also added an extensions.txt so you can see what extensions I have installed.
333fred
333fred3w ago
You don't need a launch.json, why are you trying to generate one?
Foomf
FoomfOP3w ago
I want to press f5 to debug my project from anywhere instead of needing the file with my main method in it open
333fred
333fred3w ago
You... don't need that? Just hit F5 devkit takes care of that
Foomf
FoomfOP3w ago
if I clone that repository I linked and hit f5 in it, VS code does not know what to do.
Foomf
FoomfOP3w ago
it just opens the thing at the top to have me choose a debugger
No description
Foomf
FoomfOP3w ago
even on the file that has my entry point, hitting f5 just brings up the top menu:
No description
Foomf
FoomfOP3w ago
I know I can go and click the C# button and it'll run the file that is open, but that's different from just hitting f5 and having things work
333fred
333fred3w ago
I just cloned your repo, waited a second for devkit to finish loading, and F5 works fine
No description
333fred
333fred3w ago
You can tell that the C# extension hasn't loaded here because, for example, there's no obj folder
Foomf
FoomfOP3w ago
does the C# extension make the obj folder on its own by just me opening the project in vs code?
333fred
333fred3w ago
Yes During restore
Foomf
FoomfOP3w ago
so if that obj folder isn't being made, then my c# extension must not be loaded then?
333fred
333fred3w ago
Which will happen automatically as it loads
Foomf
FoomfOP3w ago
alright my obj folder is being created automatically so my c# extension is loading
333fred
333fred3w ago
Then just hit F5
Foomf
FoomfOP3w ago
I'm expecting to see "Hello World!" in my debug console when I hit f5. That doesn't happen and from your screenshot I can't tell if it happened for you or not. I've confirmed that my extension is loaded because the obj folder was made, but when I hit f5 I am prompted to select a debugger still.
333fred
333fred3w ago
Yes, that's how VS Code works. First time through, you need to select a startup project After you select a startup project, it'll be remembered
Foomf
FoomfOP3w ago
with the launch.json I can configure all of that so that I don't need to dig around for my project's entry point when I first run it.
333fred
333fred3w ago
Sure, but you had to dig around to set up a launch.json
Foomf
FoomfOP3w ago
Just last night vs code managed to generate a launch.json that found my project's entry point and everything, and then tonight I can't get it to do it, and I don't know what I'm doing differently this night than what I did last night.
333fred
333fred3w ago
6 of one, half dozen of the other
Foomf
FoomfOP3w ago
Thank you very much for helping me out @333fred , I really appreciate you taking the time to help me troubleshoot! I eventually found this stackoverflow: https://stackoverflow.com/questions/75572318/problem-on-configuring-vscode-for-c-it-doesnt-generate-launch-json-and-tasks which is slightly different, but the suggested "generate assets" command did the trick
Foomf
FoomfOP3w ago
found the entry dll and everything
No description
Foomf
FoomfOP3w ago
Last night I clicked this button and VS Code generated the following launch.json and this is what I was expecting it to do again tonight.
No description
Want results from more Discord servers?
Add your server