title: Determine platform (x86 or x64) in post-build event
body: <p>Our c# project depends on some native dlls that we copy to output directory in a post-build command. We target both x86 and x64bit so we have to copy 32-bit version of native dlls for our x86 build and 64-bit versions of dlls for x64 build. We use Visual Studio 2015 and 2017</p>
  
  <p>I put corresponding versions of dlls in folders "Native dlls\x86" and "Native dlls\x64". In VS2017, project properties, on project's Build Page I specify "Platform target" explicitly - either x86 or x64, not Any CPU - and I plan to use a post-build command like below</p>
  
  <p>xcopy /y "$(SolutionDir)\Native dlls\ <strong><em>PLATFORM_x86_or_x64</em></strong> \*.*"  $(ProjectDir)$(OutDir)</p>
  
  <p>where <strong><em>PLATFORM_x86_or_x64</em></strong> should be a string that indicates a processor architecture the project will be built for.
  How can I determine  in a post-build event if the compiled project will be running as a 32-bit or 64-bit process?  </p>
  
  <p>On Microsoft Doc I came across a <code>PlatformShortName</code> macro but seems it is unavailable in VS 2015/2017 - it resolves into an empty string</p>
  
  <p><strong>EDIT</strong> to explain difference between this question and <a href="https://stackoverflow.com/questions/10834663/pre-and-post-build-event-parameters">Pre and Post Build event parameters</a>: </p>
  
  <p>The answers to <a href="https://stackoverflow.com/questions/10834663/pre-and-post-build-event-parameters">Pre and Post Build event parameters</a> just contain lists of pre/post-build macros that do not have a macro that specifies "<em>Platform target</em>" selection on project's Build Page (for VS 2015/2017)</p>
  
  <p>I think that there is a confusion between two terms, chosen so similar by Microsoft:</p>
  
  <ul>
  <li>"<em>Platform Target</em>" that defines for which CPU architecture (x86/x64 etc) the project will be compiled. Depending on this the compiled code will be running on Windows as 32bit or 64bit process and the process can load only 32bit or 64bit dlls accordingly. <em>Platform Targets</em> is a list with predetermined values, you cannot add a new value; </li>
  <li>"<em>Solution/Project/Build Platform</em>" that merely is a set of build settings, that include "<em>Platform target</em>" itself. Microsoft also refers to it as <em>target/targeted platform</em> in doc. You can create your own <em>solution platform</em> and give it your own name. This is a developer choice what <em>Platform target</em> will be selected for a project's <em>Platform</em>, e.g. x86 <em>Platform target</em> can be selected for "Any CPU" <em>project platform</em>, or even x86 <em>Platform target</em> for <em>Platform</em> with the name "x64". Macro <code>PlatformName</code> determines what <em>Solution Platform</em> is selected.</li>
  </ul>
  
  <p>My question was about how to determine in post-build event what <em>Platform target</em> selection was, or more precisely, whether the project would be compiled as a 32bit or 64bit process. Seems it is not possible to do in VS 2015/2017. I can create a post-build condition to check current <em>solution platform</em> (as suggested by <a href="https://stackoverflow.com/questions/57331856/determine-target-platform-x86-x64-in-post-build-event#comment101157831_57331856">Lex Li</a>) and assume targeted processor architecture (<em>Platform target</em>) but it can be independently changed (x64 to x86, or <em>Prefer 32-bit</em> selected for <em>Any CPU</em>) and then wrong native dlls will be copied to output directory and the application will fail at runtime to load them. </p>