Search code examples
visual-studiodebuggingvbscript

How to debug vbscript with Visual Studio Community (2019)


I'd like to find a free solution to debug vbscripts, and I tried Visual Studio 2019 Community Edition. I did the very basic installation with only one additional component, the Just-In-Time debugger. I ran all the following steps as administrator.

I have created the file Script2.vbs with this very simple script:

a=1
b=1/0
c=1

I started the command line (cmd.exe) and entered cscript.exe /x "C:\...\Script2.vbs cscript debug vbs

The script is executed and fails as expected at line 2 but

the problem is that the Just-In-Time debugger doesn't start.

(I expect the popup which is below "The Visual Studio Just-In-Time Debugger window appears" in this Microsoft article)

I have found in this question about the previous version of the Community Edition that there should be the option "Script", but I don't have it:

visual studio community options debugger jit script

Note also that if I try to start the script from Visual Studio Community, the menu Debug > Start debugging is grayed out:

visual studio community start debugging grayed out

My main question is:

Is the feature of debugging scripts turned off with Visual Studio Community Edition?

(which leads to the second question: is there a solution to debug VBS scripts for free?)


Solution

  • If you are still interested, there is a way to fix Visual Studio Community. It's likely some missing pre-requisites. Therefore you need to "Modify" the installed options and find "Script" debugging options in the Individual Components setup.

    For example this is my minimum set of components.

    enter image description here