These instructions are legacy - use the following guide going forward: https://dotnet-cookbook.cfapps.io/core/remote-debug/
The following is a guide on how to debug .NET Core applications on Cloud Foundry Linux containers from Visual Studio.
- Download the package from the releases page
- Publish your app with debug symbols
dotnet publish -f netcoreapp2.0 -r ubuntu.14.04-x64 -c Debug -o publish
- Extract the downloaded zip into your
publish\clrdbg
folder cf push
the app from publish folder- Create
launch.xml
file as following:
<PipeLaunchOptions xmlns="http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014"
PipePath="cf.exe"
PipeArguments="ssh YOUR_APP_NAME -command "~/app/clrdbg/clrdbg --interpreter=mi""
TargetArchitecture="x64"
MIMode="clrdbg"
ProcessId="41">
<LaunchCompleteCommand>None</LaunchCompleteCommand>
</PipeLaunchOptions>
Make sure to adjust PipeArguments
- Run the following command and record PID of your app
> cf ssh YOUR_APP_NAME --command "ps -d"
- Replace the value of
ProcessId
inlaunch.xml
with PID for your app - From Visual Studio, open Command window (View > Other Windows > Command Window)
- Run the following in VS Command Window
> Debug.MIDebugLaunch /Executable:dotnet /OptionsFile:"C:\FULL_PATH\launch.xml"
We should now be debugging