How can a code in a library project call code in the application project?
<p>In an effort to reduce duplication, I have my app's workspace split into 3 projects:</p>

<ul>
<li>Main (A library project, where all of the common code lives)</li>
<li>Free (To make the free version)</li>
<li>Paid (To make the paid version)</li>
</ul>

<p>Behavior in the free version and the paid version must differ sometimes.  How can I "call into" the final projects from the library project?</p>

<p>Here is some sample psuedo-code to illustrate my question:</p>

<h2>In the Main project:</h2>

<pre><code>private void makeADecision() {
    if (AppCode.isPaid()) {
        // do one thing
    } else {
        // do something else
    }
}
</code></pre>

<h2>In the Free project:</h2>

<pre><code>public class AppCode {
    public static bool isPaid() {
        return false;
    }
}
</code></pre>

<h2>In the Paid project:</h2>

<pre><code>public class AppCode {
    public static bool isPaid() {
        return true;
    }
}
</code></pre>

<p>That is basically what I have tried, but it won't compile because the Main project doesn't know about the AppCode class.</p>

<p>Bear in mind that this is only an example, so try not to focus on how an app can tell if it is the paid version or not. :) So far the best solution I have found is to put a string in the resources of all three projects and then make a decision based on its value but I don't like that method. Besides being ugly, I would prefer to keep functionality where it belongs.  That way I can prevent "paid-only" functionality from being compiled into the free version at all and I can avoid having to include any "free-only" code in the paid version.</p>
