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

Paths to included files gets messed up in MVC

Open egamma opened this issue 9 years ago • 8 comments

From @JerkerPihl on December 21, 2016 22:58

  • VSCode Version: Code 1.8.1 (ee428b0eead68bf0fb99ab5fdc4439be227b6281, 2016-12-19T14:49:23.350Z)
  • OS Version: Windows_NT ia32 10.0.14393
  • Extensions:
Extension Author Version
aessoft-class-autocomplete AESSoft 0.1.0
githistory donjayamanne 0.1.4
jquerysnippets donjayamanne 0.0.1
vscode-html-css ecmel 0.0.30
csharp ms-vscode 1.6.0
mono-debug ms-vscode 0.12.0
debugger-for-chrome msjsdiag 2.4.1
vscode-docker PeterJausovec 0.0.10

Steps to Reproduce:

  1. Create asp.net MVC with auth project from yo with aspnet generator
  2. Run project with dotnet run (works great, all path to jquery and stuff is correct)
  3. Exit and Open it in Code
  4. Run debugger, no paths to included javascript/jquery are correct

Copied from original issue: Microsoft/vscode#17704

egamma avatar Dec 23 '16 16:12 egamma

Hmmm... is this a working directory issue? cc @gregg-miskelly

DustinCampbell avatar Dec 23 '16 23:12 DustinCampbell

@JerkerPihl this sounds like a dupe of https://github.com/OmniSharp/omnisharp-vscode/issues/799. If so, this isn't a bug in the extension but rather some combination of by design/a documentation issue with the template. Either way, if this is the same issue -- run bower install to fix it.

gregg-miskelly avatar Dec 24 '16 00:12 gregg-miskelly

Tried bower.. was installed but wanted to updated. Updated didnt help Still doesnt explain if I run webbapp in shelfhosted console app, every path gets right but when I run in vscode included paths get wrong.

JerkerPihl avatar Jan 20 '17 12:01 JerkerPihl

I had to update the cwd property in the launch.json file so my config file (/src/web/appsettings.json) could be found when debugging.

davidsk avatar Feb 08 '17 13:02 davidsk

@davidsk @sayedihashimi does this sound like a bug with the 'yo aspnet' generator? Or with the default launch.json that we generate, or neither and just something that we document?

gregg-miskelly avatar Feb 08 '17 17:02 gregg-miskelly

The default launch.json sets the cwd to ${workspaceRoot} which I imagine is fine when running a HelloWorld console app but not when nesting your projects in folders e.g src/web. I suppose it should be documented, not sure there's anything else that can be done.

My launch.json was created by the extension, not yeoman.

davidsk avatar Feb 08 '17 18:02 davidsk

@davidsk In that case, I think we could fix the launch.json generation code to default cwd to the workspace-relative directory of the project. (ex: ${workspaceRoot}/src/web).

gregg-miskelly avatar Feb 08 '17 18:02 gregg-miskelly

If you can determine the correct path then I'm sure that'd save some confusion.

davidsk avatar Feb 08 '17 19:02 davidsk