#if - #else - #endif breaking F# Script <p>Using Visual Studio 2015 Update 3 and <code>fsi.exe</code> from F# v4.0 I' trying to run this script:</p> <pre><code>//error.fsx #if INTERACTIVE let msg = "Interactive" #else let msg = "Not Interactive" #endif let add x y = x + y printfn "%d" (add 1 2) </code></pre> <p><em>Output:</em> <strong>error.fsx(12,15): error FS0039: The value or constructor 'add' is not defined</strong></p> <p>If I then comment out the <code>#if</code>-<code>#else</code>-<code>#endif</code> block, it works fine:</p> <pre><code>// fixed.fsx //#if INTERACTIVE // let msg = "Interactive" //#else // let msg = "Not Interactive" //#endif let add x y = x + y printfn "%d" (add 1 2) </code></pre> <p><em>Output:</em> <strong>3</strong></p> <p>I'm sure I'm doing something wrong (rather than this being a bug) but I can't for the life of me figure out how to make this work.</p> <p>Thoughts?</p>