vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

VS Code doesn't create tasks/launch.json for projects published from VS Docker Tools

Open rajkumar42 opened this issue 10 years ago • 16 comments

  1. Install Web tools extensions
  2. Open VS. Create new project VIsual C# -> .NET Core -> ASP.NET Core Web Application (.NET Core).
  3. Open the project location in VSCode.

VSCode does not create tasks.json and launch.json files. The project could not be built or launched.

rajkumar42 avatar May 17 '16 23:05 rajkumar42

Are you opening the directory that actually contains the project.json? Or are you opening a directory that contains a src/<web app>/project.json? I think we only support adding these assets if project.json is on the workspace root.

chuckries avatar May 18 '16 00:05 chuckries

@chuckries is 100% correct

DustinCampbell avatar May 18 '16 00:05 DustinCampbell

I'm opening WebApplication1\src\WebApplication1 folder where project.json contains project.json. I've tried opening it under WebApplication1 as well.

What is the workspace root when I create a template project?

rajkumar42 avatar May 18 '16 16:05 rajkumar42

<workspace root> refers to root directory opened in VS Code. It looks like the root directory of the VS project template for .net core web app contains the project.json, which is where the project should be opened in VS Code.

chuckries avatar May 18 '16 16:05 chuckries

Apparently this only reproduces on docker scenarios. Following are my repro steps Install Web tools extensions 2.Open VS. Create new project VIsual C# -> .NET Core -> ASP.NET Core Web Application (.NET Core). 3. Add docker support from VS. 4. Run the app on docker container. 5. Close VS. 6. Open the project workspace on VSCode.

rajkumar42 avatar May 18 '16 17:05 rajkumar42

Does docker alter the project.json at all?

chuckries avatar May 18 '16 17:05 chuckries

Step (4) is the key. Looks like (4) produces a project.json in \WebApplication5\src\WebApplication5\bin

after deleting that VSCode can produce launch.json and tasks.json.

rajkumar42 avatar May 18 '16 17:05 rajkumar42

@DustinCampbell do we think the problem is that OmniSharp should be ignoring project.json's in the 'bin' directory? Or will the experience be good enough once #310 is fixed?

gregg-miskelly avatar May 18 '16 18:05 gregg-miskelly

#310 will certainly alleviate the problem. It might not be perfect though.

DustinCampbell avatar May 18 '16 18:05 DustinCampbell

@NCarlsonMSFT @SteveLasker is it a requirement that the Docker tools extension copies the project.json file into bin?

gregg-miskelly avatar May 18 '16 19:05 gregg-miskelly

@gregg-miskelly The project.json in bin is the project.json for clrdbg that is pulled in by GetClrDbg.ps1. It is not a copy of the app's project.json. @rajkumar42 please correct me if I'm wrong.

chuckries avatar May 18 '16 19:05 chuckries

I see. Maybe we can delete the file when we are done restoring?

gregg-miskelly avatar May 18 '16 19:05 gregg-miskelly

Is that something you can take care of in the GetClrDbg scripts? Or do you need us to try and clean up in the scaffolded script from VS. If the later how can we determine what in the InstallPath folder is safe to delete?

NCarlsonMSFT avatar May 18 '16 21:05 NCarlsonMSFT

I can modify GetClrDbg.sh to delete its project.json after successful install if we think that is best.

chuckries avatar May 18 '16 21:05 chuckries

I also considered doing it this way originally: the script could generate project.json/nuget.config somewhere under %TEMPDIR% and publish to the correct output directory.

chuckries avatar May 18 '16 21:05 chuckries

This is being fixed with https://github.com/Microsoft/MIEngine/pull/332

gregg-miskelly avatar May 18 '16 23:05 gregg-miskelly