# Local Debugging

## Local Debugging

## Executing the Debugger

### Run from a PowerShell Project

With PowerShell Tools for Visual Studio, a couple new project templates are included. When working with a script that is part of a PowerShell project, you can execute the current script by simply starting debugging like you would with any other language inside Visual Studio. Pressing F5 or the Start Debugging button will allow you to execute and debug your script.

To create a PowerShell Project, just navigate to File->New->Project and select one of the PowerShell project types.

![](https://camo.githubusercontent.com/fa0d1edc98590c9db85fa9dbd47d6263ecca0dfc/687474703a2f2f692e696d6775722e636f6d2f717331386a724d2e706e67)

### Run a script from any project type

Scripts can also be run from any type of project using the context menu items or shortcut commands. Right clicking in a PowerShell script will show the option to run the script or the selection.

![](https://camo.githubusercontent.com/136651d8e10a744a6515287469c6734644a7e6cb/687474703a2f2f692e696d6775722e636f6d2f4d7133376a4b552e706e67)

You can also run a script from the solution explorer. Just right click on the script and select Execute as Script.

![](https://camo.githubusercontent.com/49415f7630b636d8914d44440f59596a67b03552/687474703a2f2f692e696d6775722e636f6d2f6b5a6f6872364b2e706e67)

## Execute Selection&#x20;

You can execute a selection using the Ctrl+F8 key or by right clicking the code and clicking Execute Selection.&#x20;

![](/files/-M3NwBTM9qN0DAvJtbVu)

You can execute a selection from within a PS1 file.&#x20;


---

# Agent Instructions: 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://docs.poshtools.com/powershell-tools-documentation/visual-studio/chapter1/local-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.
