AutoLISP with VS Code
Sunday, January 25, 2026To develop AutoLISP macros, VLIDE (Visual Lisp IDE) is traditionally used. But since AutoCAD 2021, Autodesk offers an alternative: VS Code with the AutoCAD AutoLISP Extension.
Installing Microsoft Visual Studio Code and the AutoCAD AutoLISP Extension
When you type VLISP on the command line for the first time with a freshly installed version of AutoCAD, the following screen is displayed:

If you choose the first option and Visual Studio Code is not installed, you will see the following screen:

The Download link will take you to the Visual Studio page. Be careful here, Visual Studio is different from Visual Studio Code. It is a complete development environment, while Visual Studio Code is a code editor. Visual Studio is not at all suitable for AutoLISP development, you need Visual Studio Code. You can download it for free here.
Choose the installation for the current user for Windows x64.
The next step is installing the AutoCAD AutoLISP Extension. Just click the Install button and follow the instructions.
Restart VLISP, you should switch to VS Code and the following message should appear:

Writing AutoLISP Code with VS Code
Press Ctrl + N to create a new file. Press Ctrl + K, release Ctrl and press M to choose the AutoLISP language.
Type the following code:
(defun c:hello ()
(princ "Hello, World!")
(princ)
)
Running AutoLISP Code
Press Ctrl + F5 to run the code. VS Code will prompt you to save your file with a .lsp extension.
Switch to AutoCAD and type the name of the command you just created (HELLO). Hello, World! should appear in AutoCAD's text window.
Debugging AutoLISP Code
The extension includes a debugger. You can set a breakpoint on a line of code with F9. When you run your HELLO command again, the debugger will activate, VS Code will come to the foreground, and you will be able to inspect variables, the call stack, etc.
You can even use VS Code's integrated console to execute AutoLISP commands.
Advantages over VLIDE
You have a much more modern code editor that allows you to use AI. VS Code offers many features such as multiple cursors, Git integration, refactoring (symbol renaming for example) that make you more productive.
Another major advantage: VS Code offers multi-file search and replace (Ctrl + Shift + H). This is extremely useful when you need to rename a variable or function used throughout your project. In VLIDE, you have to open each file one by one and perform the replacement manually.
Limitations
To compile to fas, there is no button that lets you do it in one click, you must use vlisp-compile:
(vlisp-compile 'st "my_program.lsp")
Well, it's not very complicated, so it's not a big deal.
To create a VLX, normally in VLIDE, you need to use the wizard that lets you create an application. At Autodesk, they thought of this, as they added a command to AutoCAD named MAKELISPAPP to launch this wizard without going through VLIDE.
The MAKELISPAPP command (Make Application) defines the files and options used to build a VLX application. The wizard generates a .PRV file that contains the entire configuration for your application. From there, you can:
- Edit the configuration of your application using the Properties option, which lets you reopen and modify the .PRV file.
- Rebuild the VLX using the corresponding option, without having to go through all the wizard steps again.
Note: do not confuse .PRV and .PRJ files. The .PRJ file is the VLIDE project definition file: it contains the location and names of all source files that make up the project, as well as certain parameters and rules for generating the final FAS files. The two formats are not compatible: .PRV is designed for the VS Code extension, while .PRJ is for VLIDE.
Working with multiple source files
If your application is made up of multiple files, a good practice is to create a bootstrap file that loads all your files. And conveniently, the .PRV file already contains the list of all your application's source files in the :load-file-list section:
(:load-file-list (:lsp "utils.lsp") (:lsp "commands.lsp") (:lsp "dialogs.lsp"))
So we can write a loader that reads the .prv directly to extract the files to load:
;; loader.lsp — loads files listed in the .prv
(defun load-from-prv ( prvFile / base file line position start
endPosition name )
(setq base (vl-filename-directory prvFile))
(setq file (open prvFile "r"))
(while (setq line (read-line file))
(setq position 0)
(while (setq position (vl-string-search ":lsp \"" line position))
(setq start (+ position 6))
(setq endPosition (vl-string-search "\"" line start))
(if endPosition
(progn
(setq name (substr line (1+ start) (- endPosition start)))
(load (strcat base "\\" name))
)
)
(setq position (1+ endPosition))
)
)
(close file)
(princ "\nApplication loaded.")
(princ)
)
(load-from-prv "D:/Projects/MyApplication/Program1.prv")
For the function to locate the .prv file, you have two options:
- Hardcoded absolute path: as in the example above, you specify the full path to the .prv file.
- Use
findfile: if you add the directory containing the .prv to AutoCAD's search path (Options → Files → Support File Search Path), you can simply write(load-from-prv (findfile "Program1.prv")).
The advantage of this approach is that you have a single source of truth: the .prv file. When you add or remove a file via MAKELISPAPP, the loader picks it up automatically. Every time you want to test your application, just start debugging on this file to reload all the code.
Switching back to VLIDE
If you can't get used to the environment, you can switch to VLIDE by modifying the LISPSYS system variable. Set it to 0 and restart AutoCAD.
To return to VS Code, set it to 1.
Conclusion
I know it's not easy to change your habits, but you have everything to gain by switching to VS Code for developing your AutoLISP programs.
If you want more information on the subject, consult the official AutoCAD documentation here.
Need an AutoCAD (AutoLISP, ObjectARX, .NET, VBA) development? Contact me for a free quote.