I'm trying to make Visual Studio build system to copy a file to the output directory for a C# project. This file is both platform (x86/x64) and configuration (Debug/Release/...) dependent. For instance I have different files for Debug|x64 and Release|x64 builds. The way I wanted to handle this was by adding a file to the project in the Solution Explorer and manually editing the project file.
For example, if I wanted to copy the file named myfile.dat to the output directory, I would write the following set of macros in the C# project file:
<ItemGroup>
    <Content Include="$(SolutionDir)\data\$(Configuration)\$(Platform)\myfile.dat">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
</ItemGroup>
My idea was that the file myfile.dat would be copied from one of the subfolders in the data folder, depending on the selected build type.
Solution folder
|
+--data
   |
   +--Release
   |  |
   |  +--x86
   |  |
   |  +--x64
   |
   +--Debug
      |
      +--x86
      |
      +--x64
But for some reason the $(Platform) macro always evaluates to AnyCPU, when it's part of the file reference path. Actually there are two macros $(Platform) and $(PlatformName), and they both evaluate to AnyCPU. I coulnd't find any documentation describing the difference between these macros.
I also tried to evaluate these macros in the Pre-build event and it gave the correct result then. 
I understand that I can use Pre-build event to copy the file, I'm just curious why it doesn't work as part of the file reference path. It there another part of the project file that I need to change for this to work?
UPDATE
PS. Project platform is set to values either x86 or x64. In fact the AnyCPU platform is deleted from the Configuration Manager.