> For the complete documentation index, see [llms.txt](https://onsharp.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onsharp.gitbook.io/docs/basic-usage/debugging.md).

# Debugging

## Prerequisites

We assume that you already have a running Onset server, Onsharp installed and a theoretically working plugin project.

### Setup Debugging

1. First of all, activate dependency export for your project, if you does not have it currently:
   1. Therefore right click your project and **Edit Projectfile** (.csproj)
   2. Search the line with the **TargetFramework**
   3. Put the following line below the TargetFramework line:

      `<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>`
2. Go to the properties page of your project (***Right-Click on Project** -> **Properties***)
3. Head over to the **Debugging** page
4. Change the **Launch** dropdown to ***Executable***
5. Select the ***OnsetServer.exe*** of your Onset server in your server directory via the **Browse** button close to the textbox and the **Executable** label
6. Select ***your server directory*** under **Working Directory**
7. Now head over to the **Build Events** page and put the following commands into the text area for post-build event (Post-build event command line): *view below*

   Replace YOUR\_SERVER\_DIRECTORY with the path to your server directory. Keep in mind to change every slash (/) in the path to a backslash (\\)
8. Now your debugging can begin!

The commands for the post-build event command line:

```bash
copy /Y "$(TargetPath)" "E:\Development\Onset\_test-server\onsharp\plugins\$(TargetFileName)"

del /Q "$(TargetPath)"

del /Q "$(OutDir)\$(TargetName).deps.json"

del /Q "$(OutDir)\$(TargetName).pdb"

del /Q "$(OutDir)\Onsharp.dll"

del /Q "$(OutDir)\DotNetZip.dll"

del /Q "$(OutDir)\Goblinfactory.Konsole.dll"

del /Q "$(OutDir)\Nett.dll"

del /Q "$(OutDir)\Newtonsoft.Json.dll"

del /Q "$(OutDir)\Serilog.dll"

del /Q "$(OutDir)\Serilog.Sinks.Console.dll"

del /Q "$(OutDir)\System.Security.Permissions.dll"

xcopy /Y "$(OutDir)" "YOUR_SERVER_DIRECTORY\onsharp\libs"
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://onsharp.gitbook.io/docs/basic-usage/debugging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
