Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Visual Studio Code automatically load required assets

I have started using Visual Studio Code.

I did the following steps to create a new .Net Core console project:

  • Opened a folder
  • Started the Terminal
  • Issued the command dotnet new
  • Issued the command dotnet restore
  • Hit F5

I always get a Warn sign about the missing assets:

enter image description here

I chose Do not ask me again, and it was a very bad idea as it creates a template tasks.json and I have to manually replace the output path.

Unfortunately, there is no option like Do not ask me again and load the assets automatically, so it seems I have to manually load whenever I create a new project.

Is there a better solution?

like image 988
Nestor Avatar asked Dec 05 '16 19:12

Nestor


2 Answers

The Visual Studio Code C# extension can generate assets to build and debug for you. If you missed the prompt when you first opened a new C# project, you can still run this command by opening the Command Palette (View > Command Palette) and typing ">.NET: Generate Assets for Build and Debug". Selecting this will generate the .vscode, launch.json, and tasks.json configuration files that you need.

Source: https://github.com/dotnet/docs/pull/6456/files/0af542730e9b108964a09fe67b16d5bd70626fca#diff-1e85f61328dc43337b1fbf612b1b8b57dfdd8bb3768daf9004dcd9b4ae38f4b0

like image 113
laskalex Avatar answered Sep 21 '22 06:09

laskalex


Edit: this is not directly answering the real question but answering a similar question that linked me to here of "what do I do if I hit 'Don't ask me again' by mistake.". Feel free to downvote :-)

It's crappy, but you CAN get around the disappearance of the prompt by manually deleting a flag.

From the command palette, "toggle developer tools"

From there, look go to the "application tab" and look at "file" under "local storage"

enter image description here

Scroll through the list until you find the "workspace" row that points to the workspace you need. You'll find a json blob that looks similar to this.

enter image description here

You should see assetPromptDisabled set to true. Set it to false and restart VS Code. Now you'll get the prompt again.

like image 33
Llewey Avatar answered Sep 23 '22 06:09

Llewey