Unfortunately, it doesn't feature intellisense for C/C++, only syntax
highlighting: code.visualstudio.com/docs/languages EDIT: no debugger
integration for C/C++ either. The git integration is really nice
though! Seems more designed for web applications, the debugger works
for node.js
Whilst this does not specify C#, it stands to reason that the same standards apply (which is that there is no debugger and no compile functionality).
The C# extension supports limited full .NET framework debugging. It can only debug 64-bit applications with portable PDBs.
But, even after reading many issues and discussions about this topic, it remained a little bit unclear for me what the necessary steps were, so I will expose here a little guide with the steps that I have followed and that worked for me, and hopefully, will also work for you.
The necessary files/folders are:
a. .vscode with launch.json and tasks.json.
b. bin\Debug folder for your .exe application and the assemblies you might want to create a reference to.
d. the <project>.csproj and Program.cs files.
e. optionally a batch file, whose purpose I will describe later.
change the Project Sdk="Microsoft.NET.Sdk" to Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003".
in the first PropertyGroup we must set the OutputType to Exe (the default may be dll), remove the TargetFramework property, replacing with TargetFrameworkVersion with value v4.6.1 (example for .NET Framwork 4.6.1, it may be 4.7 for instance), and finally put the runtimes win-x64 and win7-x64 (and any other that the compiler may complain). This first PropertyGroup should look like this:
Some comments: the condition used signals that these properties only apply when the configuration passed to the compiler is Debug and the Platform is "AnyCPU", you might want to insert other conditions with different values, or even don't use a condition at all; the most import values here are: The PlatformTarget property must be x64 and the DebugType must be portable; the output path is set to bin\Debug.
As we are not using the Microsoft SDK we must include the Program.cs, so that the compiler can find it:
Create a new configuration(e.g. MyLauncher), whose type must be clr, and that points to your program; the preLaunchTask will be set to a manually configured one ("mybuild", for instance) that will be specified in the tasks.json; an example of the configuration is:
Create a task "mybuild" with the commands to build your project.
We will use the MSBuild 15 here (don't use the dotnet build - at least it has not worked for me).
You can directly point to the (path)\MSBuild.exe (or msbuild.exe, if it is in the %PATH%) file with the arguments to build the project. One example is shown below, note that I've set the Configuration to Debug and the platform to AnyCPU, matching the condition Ive set in the .csproj file, also note that the backslashes in \"AnyCPU\" are because of the use of the quotation marks.
but there is another way, using the .bat file; in my case the path to the MSBuild.exe had spaces and that was generating an error when the task run, so that I've put the following code in a .bat file (save notepad as name.bat):
I just created a simple console application and customized the csproj file. Afterwards, I could attach the OmniSharp debugger to a full .NET framework application. The csproj file looks like this:
I just followed the official documentation: I changed TargetFramework to run on .NET 4.7, the PlatformTarget to 64 bit and the DebugType to portable.
Furthermore, I updated launch.json:
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Launch (console)",
"type": "clr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/net47/FullNetInVsCode.exe",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Attach",
"type": "clr",
"request": "attach",
"processId": "${command:pickProcess}"
}
,]
}
In this file, I just changed type to clr in both JSON objects, and targeted program to the exe file.
Afterwards, I could set a break point and simply press F5 to start debugging on full .NET framework:
To start with, install Build Tools for Visual Studio 2019
To your VS Code workspace add .vscode folder and add tasks.json to build your project. Use below a sample of tasks.json can be used mostly for any .Net Framework project.