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?
"Copy to Output Directory" is the property of the files within a Visual Studio project, which defines if the file will be copied to the project's built path as it is. Coping the file as it is allows us to use relative path to files within the project.
output directory. [ESRI software] In ArcIMS, the folder designated during installation to hold files being served to users for display in a browser.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With