You're1 doing it wrong.
The Conditional=
solution works, but using it causes the behavior you're1 seeing. Visual Studio appears to only evaluate which files will be shown in the Solution Explorer once. Basically this makes Visual Studio think that the file isn't even a part of the project.
The real solution is to use the same <ExcludedFromBuild>
tags that the C files use (which are added when you select the "Excluded From Build" option in the file's properties pages.
<ItemGroup>
<!-- This causes the items to not be shown in Solution Explorer -->
<!--
<MASM Include="asmcode32.asm" Condition="'$(Platform)'=='Win32'" />
<MASM Include="asmcode64.asm" Condition="'$(Platform)'=='x64'" />
-->
<!-- This is the right solution. -->
<MASM Include="asmcode32.asm">
<ExcludedFromBuild Condition="'$(Platform)'=='x64'">true</ExcludedFromBuild>
</MASM>
<MASM Include="asmcode64.asm">
<ExcludedFromBuild Condition="'$(Platform)'=='Win32'">true</ExcludedFromBuild>
</MASM>
</ItemGroup>
It's a shame that this option is not exposed via the GUI, like it is for C files.
1 - "I'm"