Can you tell Visual Studio to output a different name of an exe file depending on if a specific conditional compilation symbol is set?
Right click the project (The Class Library is a project) and click Properties to open the properties window. Then click the Build tab, input symbols in the “Conditional compilation symbols:” textbox. Use comma to separate each symbol (e.g. “MySymbol1,MySymbol2”). Then use them in this way.
Conditional compilation is the ability to specify that a certain block of code will be compiled into the application only under certain conditions. Conditional compilation uses precompiler directives to affect which lines are included in the compilation process.
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.
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