Reputation: 8862
How I do to work with non-Core Asp.Net MVC projects on Visual Studio Code?
I'm tired of slowness of Visual Studio Community, so I was thinking about if I can setup an VS Code environment for that.
Upvotes: 2
Views: 3602
Reputation: 1083
I've successfully setup my Visual Studio 2015+ ASP.NET project on VSCode.
I've created an gulpfile that handle the build for me:
You can find the gulpfile on my project's Github
Upvotes: 1
Reputation: 66
Here is how I was able to do it for my projects:
Now the basic flow looks like this:
At this point you should be able to Go to any type with CTRL+T and typing the type name. Use CTRL+P to find files and edit them. And to build press CTRL+SHIFT+B. If you don't have vscode task configured for building, I believe VS Code will build a scaffold file for you which you need to fill out and then msbuild can be invoked to build your solution. Check mine out (put this in .vscode directory, in a file called tasks.json):
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "msbuild",
"args": [
// Ask msbuild to generate full paths for file names.
"/property:GenerateFullPaths=true",
// "/p:Configuration=Release",
"YOUR SOLUTION FILENAME.sln"
],
"taskSelector": "/t:",
"showOutput": "silent",
"tasks": [
{
"taskName": "build",
// Show the output window only if unrecognized errors occur.
"showOutput": "silent",
// Use the standard MS compiler pattern to detect errors, warnings and infos
"problemMatcher": "$msCompile"
}
]
}
It will take some time to get used to but once you are there, it's awesome. No more VS.NET memory hogging and overall slowness.
I love it how fast the editor starts and closes. Just get used to the flow of open folder, CTRL+T or CTRL+P for navigating between classes/code files. And be patient with OmniSharp (C# plugin) as at times it becomes nonresponsive and syntax highlighting becomes unavailable. At that point, I just restart OmniSharp (via a CTRL+SHFT+P, find OmniSharp, restart option).
Biggest things I miss: debugging. VS Code with C# plugin only supports .NET Core debugging as far as I know. The way I get around this is usually having unit tests and then isolating the code I want to debug via a unit test and just iterate on the test until the problem is solved. In rare cases where I absolutely need a debugger, I just power up the good ol' Visual Studio beast, do debugging and get out.
Hope this helps!
Upvotes: 5