title: How to enable inclusion of x86 and x64 asm files into a single Visual Studio project?
body: <p>I'm using Visual Studio 2017 Community to build a test console C++ application. I need to include an assembly function into that project:</p>
  
  <pre><code>extern "C" void* __fastcall getBaseFS(void);
  </code></pre>
  
  <p>To include an asm file I right-clicked the project and went to "Build dependencies" -> "Build Customization" and checked "masm" in the list there.</p>
  
  <p>I can then add an asm file by right-clicking my project -> Add New item -> and then add "asm_x64.asm" file where I write my x86-64 asm code:</p>
  
  <pre><code>.code
  
  getBaseFS PROC
  
  mov ecx, 0C0000100H   ; IA32_FS_BASE
  rdmsr
  
  shl rdx, 32
  or rax, rdx
  
  ret
  
  getBaseFS ENDP
  
  END
  </code></pre>
  
  <p>This works in a 64-bit project.</p>
  
  <p>The problem is that when I switch solution platform from x64 to x86:</p>
  
  <p><a href="https://i.stack.imgur.com/Mhkdc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mhkdc.png" alt="enter image description here"></a></p>
  
  <p>my asm file needs to change. So in a sense I need to include a different "asm_x86.asm" file into compilation that is used only for x86 builds vs. x64 builds.</p>
  
  <p>What's the best way to automate this switch?</p>