I know how to select files that I want copied to the output directory of my build via Properties=>Copy Always, but I haven't been able to find a way to copy a different file depending on the build type.
I have two separate config files, one set up for local development (ie. should be copied on debug build only) and one that is set up for the server environment (ie. should be copied on release build only).
Does anyone know how to achieve this type of conditional functionality?
Currently I have achieved the desired functionality by using a slight modified version of the answer in this post that @Bayeni shared: https://stackoverflow.com/a/8083060/1428743
This is currently working for me, but if there is a better way to go about this please let me know.
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<Content Include="local.cfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
<Content Include="release.cfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
Why don't you use a PostBuild event and call xCopy to copy the files you need?