I have a project in VB.NET 2010 (compiling to x86, .NET 2.0 runtime) that I want to compile into two separate EXEs – a “lite” version and a “full” version.
Unfortunately I cannot make two separate projects as it uses the Adobe Reader COM control – and sharing a form using that control between two projects seems to confuse the IDE (something to do with COM Interop, I assume – if someone knows how to share a form hosting the adobe reader control, that would solve my problem too).
I have found this thread:
Change name of exe depending on conditional compilation symbol however I don’t have any MSBuild experience so I need more explicit instructions.
On the “My Project>Compile” tab there is a “Build Events…” button. I was wondering if anyone knows how to set a conditional compilation constant and use that to determine the EXE name (or change it after build).
If all else fails I can rename the EXE manually I suppose, but I’d prefer it to be automated.
If having two separate projects within your solution isn’t acceptable, you’ll want to look into creating your own MSBuild script.
Here is an example of a custom MSBuild script that will allow you to define your custom compilation constants at build time, and then build your two versions of your application (“Full” and “Lite”):
What you’ll need to do:
Within your project, you can use the “FULL” and “LITE” conditional compilation constants to determine whether to compile certain statements: