I am having difficulty figuring out if and how I can use Visual Studio Code to develop and debug command-line/console/libraries of C#.Net programs which
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:
Exe
net47
x64
portable
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: