Page 1 of 1

Setting Up Visual Studio Community 2017 for x64 MASM

#1 Martyn.Rae   User is offline

  • The programming dinosaur
  • member icon

Reputation: 556
  • View blog
  • Posts: 1,436
  • Joined: 22-August 09

Posted 11 November 2018 - 11:41 AM

Setting Up Visual Studio Community 2017 for x64 MASM

It suddenly dawned on me that you may not know how to set up Visual Studio Community 2017 to be able to compile and run x64 assembly. So a quick tutorial is in order.

Firstly download and install Visual Studio Community 2017 from the Microsoft Web Site (it's free of charge by the way!). Part of the installation progress you will be presented with a window that contains four tabs 'Workloads', 'Individual Components', 'Language Packs' and 'Installation locations'. On 'Workloads' click on the checkbox in the top right hand side og 'Desktop development with C++' all the other items under workloads are optional. If you are happy with the selections you have made, select 'Install' down in the bottom right of the window and wait for the installation to complete.

One the installation is complete, launch Visual Studio. Create a Microsoft account if you don't have one and wait for Visual Studio to complete it's setup.

Select File from the main menu, then new then Project. The new project screen will appear. If you have only installed C++, then you will see in the middle part of the window, three items 'Windows Console Application', 'Empty Project' and 'Windows Desktop Application'. It does not matter which of the items you select but of an assembly application I normally select 'Empty Project'. At the bottom of this window, enter the name you are giving to your application, where you want Visual Studio is to create the new project and the solution name. Finally select OK on the bottom right.

Select 'Source Files' located in the 'Solution Explorer' window to the right of the main work area and right click, select 'Add' and then 'New Item'. The 'Add New Item' window appears. Select either the 'C++ File (.cpp)' or 'Header File (.h)'. It does not matter as we are going to set the filename and the extension after the file has been created. Go down to the 'name' entry field and enter a name for your source. Remember to use an extension of '.asm'. Finally click on the 'Add' button on the bottom right of that window.

On the top of the main window, just underneath the menu, you will see a drop-down box that reads 'Debug' and to the right another drop-down that says x86. Leave the 'Debug' drop-down as is and change the x86 to x64.

Next, back over to the 'Solution Explorer' window and right click over the file you have just added (with the extension '.asm'. A popup menu will appear and you need to select the 'Properties' menu item. A new window will appear '*.asm Property Pages'. Move over to the right hand side and select the drop-down 'Excluded From Build'. Select 'No' then right click on the drop-down for the 'Item Type' that currently reads 'Does not participate in build'. Scroll down to the item 'Custom Build Tool' and select it.
Select the 'Apply' button located at the bottom right of the window. An additional item will have appeared below the 'General' item in the left hand window entitled 'Custom Build Tool'. Left click on the 'Custom Build Tool' and it will show you a single additional line entitled 'General'. Left click on that 'General' item and the right window will display a number of items, the first of which is the command line that is used to invoke the custom build tool. Here, enter 'ml64.exe /c /Zi ' and the name of the source file you created. Next, in the 'Outputs' field, enter the name of the source file and replace the '.asm' extension with '.obj'. So, for example if your source filename was 'martyn.asm', then the 'Outputs' filename you enter would be 'martyn.obj'. Finally, select the 'OK' button at the bottom of the window. The properties window will close.

Next, left click on the main window to the left of the 'Solution Explorer' and enter 'end'. Back over to the solution explorer and right click on the source file and select 'compile'. This is simply to ensure that everything has been entered and is working. In the output window you should see a success build.

Hopefully that has been useful.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1