HOWTO integrate NASM with VS2019

Occasionally I use assembler to squeeze processing power from my programs.

A cheap solution was C inline assembler sections, but VS2019 doesn’t support them into a 64-bits program.  Other compilers use other more or less complex solutions (IBM assembler, …).

This forced me to consider to have & link .asm files in my projects.  I can split them with 32 and 64 bits code and compile them when needed.  Then I tried to use MASM included in Visual Studio… but I found it really complex to use, and quite poorly documented.

So I started to consider using NASM, an open-source assembler compiler, simpler and much better documented.

Download and Installation

The first step is to download and install the following needed pieces.

then install the first file (for example into “c:\nasm” folder) and copy VSNASM files in the same folder.

The last thing is to define an environmental variable NASMPATH with the installation folder with the final ‘\‘ (“c:\nasm\” in our example).

NOTE1: I warmly suggest to install it, into the ‘program files‘ folder to keep them safer.

NOTE2: I also warmly suggest to edit ‘nasm.xml‘ to change the display name to “NASM – Netwide Assembler” into the following nodes at the end of the file:

  • ItemType
  • ContentType

Setting up Visual Studio

Start Visual Studio and:

  • open ‘Tools‘->’Options…‘ window from the main menu.
  • go to ‘Projects and Solutions‘ -> ‘VC++ Project Settings‘.
  • set ‘Build Customization Search Path‘ with your NASM installation folder.
  • confirm and exit.

Although it is not mandatory, I suggest also to install ‘AsmDude‘ extension for syntax highlighting into .asm files.

Once installed, it can be configured for Nasm Intel Syntax highlighting from VS options.

VS Project Setup

The last step is to enable .asm support into your project.

  • open your project.
  • right-click each project using .asm files.
  • select ‘Build Dependencies‘->’Build Customizations‘.
  • check ‘nasm‘ option.
  • confirm.

Then for each .asm file, you have to:

  • open the file ‘Properties
  • set into ‘General‘->’Item Type‘ to ‘Netwide Assembler‘ (or whatever you set, “NASM – Netwide Assembler” in my case).
  • enable the debug information for the debug profile from the specific NASM options.
  • confirm.

NOTE: from this last property window, we can also set if to compile the file or not in 32/64 bits target platforms.


After all these steps, we can start with something like:

bits 32

section .data
<put your data here>

section .text
<put your function here>

Have fun