I'm working at WPF app. I'm trying to use Target Name="AfterBuild" ... to replace my .exe.config file with my Debug.config or Release.config (depends on current configuration.
My .csproj file contains the code:
<Target Name="AfterBuild">
<Delete Files="$(TargetDir)$(TargetFileName).config" />
<Copy SourceFiles="$(ProjectDir)$(Configuration).config" DestinationFiles="$(TargetDir)$(TargetFileName).config" />
</Target>
When I build my solution in Debug or Release configuration, it works well - my .exe.config file is replaced with file I want to.
BUT when I try to RUN (F5) my application, it just takes App.config (which is default) and renames it into .exe.config without any replacing. Or, may be, replaces correctly at first and after that - replaces again with App.config. I can't determine it exactly. But in result - I get "pure" App.config without any changes.
So how can I enforce MSBuild not only use my "changed" configs to replace during build, but to replace during run too.
Thank you