-
Notifications
You must be signed in to change notification settings - Fork 8
Debugging a script
This document explains by example the steps required to use Visual Studio to debug .csx files that are executed with scriptcs. Hopefully you won't need to debug very often, but if you are in need be sure to follow this example.
- The following example shows how you can debug the WebApiHost sample. This procedure assumes that you have the .csx, packages.config and Packages folder already setup.
- You must have the Roslyn CTP installed to get VS to recognize .csx files.
-
Open Visual Studio.
-
Open the Open Project dialog by navigating to File -> Open -> Project/Solution.
The resulting solution explorer should look like this:
-
Right-click the scriptcs solution item and click Properties.
-
Provide values for the following fields:
- Arguments:
server.csx -debug - Working directory: the source folder of the app you want to debug, in this the directory where server.csx is located.
- Arguments:
-
Close the Properties window and save the solution.
-
Add server.csx to the solution by right-clicking the solution and selecting Add Existing Item.
-
Set a breakpoint in the
return "Hello World";line of the TestController. -
Press F5.
-
Open any browser and navigate to localhost:8080/api/test.
That's it, the breakpoint will be hit. You have all the goodness of VS, such as the Immediate Window, Add Watch to help you debugging.



