One possible approach is to guard the body of that sketch with an #ifdef ... #endif
pair, and use Visual Micro's “Project Properties” to define (or not) a preprocessor symbol. [If the .ino or .pde in question is used as a #include
file, you would instead guard all the #include
instances.]
Refer to the “Project Defines” page at visualmicro.com for how to define a preprocessor symbol and its value. [Via: Tools > Options > Visual Micro > Compiler > Show Build Properties] Also see How do I add additional compiler switches in Visual Studio.
If necessary, you can use other tests besides #ifdef
to control compilation. The first link above shows the following example.
#if USBPORT > 3
....your code here....
#endif