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.
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.
You can also run a script from the solution explorer. Just right click on the script and select Execute as Script.
You can execute a selection using the Ctrl+F8 key or by right clicking the code and clicking Execute Selection.
You can execute a selection from within a PS1 file.