Change name of exe depending on conditional compilation symbol

If you load the .csproj file into a text editor, you can control the AssemblyName property:

<AssemblyName Condition="'$(Configuration)' == 'Debug'">WindowsFormsApplication9.Debug</AssemblyName>
<AssemblyName Condition="'$(Configuration)' != 'Debug'">WindowsFormsApplication9</AssemblyName>

Note though that this does not only change the file name, but the assembly name, which might mean trouble if you have other code referencing the assembly.

I never did this myself, so I can’t really say how good or bad the idea is.

Leave a Comment