0

I'm changing my project's code (VB.NET 2015) so that it will have two versions. A full one and a minimal one. I have used conditional compilation with two options (FULL & AGENT), and marked the parts to be excluded from the minimal version using the standard #if FULL then ...

However, the project uses a couple of files and I need to completely exclude some of them when compiling the minimal version.

I have done some searching and found things like this:

How to: Exclude Files from the Build

But I don't see that it is conditional (so the FULL version will compile them and minimal will ignore) neither do I find a project file in my project that looks similar to those examples.

So, how do I exclude files when compiling the minimal (AGENT) version and include them when compiling the FULL version?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
GilU
  • 11
  • 3
  • 1
    Put the `#if FULL then` around the entire files content in each file? – GSerg Jul 21 '16 at 09:22
  • I actually tought about it but it seems very un-elegant... Also, I'd reather not have these files at all and not "empty" them from content. Any other ideas? Thanks – GilU Jul 21 '16 at 09:38
  • Simply use two project files. – Arvo Jul 21 '16 at 09:48
  • 1
    There is no such thing as "empty file" after compilation. – GSerg Jul 21 '16 at 10:08
  • Like Arvo said, you can use two projects, where both projects use the same source files. For each file you can decide in which project it is present. If this is not conditional enough, you can create one master project, which incorporates the two sub projects... – DrDonut Jul 21 '16 at 10:41
  • "There is no such thing as "empty file" after compilation." @GSerg It looks like two project files are the right way for what I need - but, Just for my understanding: If I have a form that the application does not load in any situation - the compiler will not compile it? Thanks, Gil – GilU Jul 24 '16 at 04:22
  • @GilU [It will](http://stackoverflow.com/q/10192076/11683). That's not what I was saying - I was saying that if you put an `#if` around the entire file, that effectively removes it from compilation because there are no files left after compilation. There won't be an empty entity in compiled code to represent the empty code file. You can't do that to forms though because forms are more than just code files (also resource files, you don't put `#if` around that). – GSerg Jul 24 '16 at 06:55

0 Answers0