<p>I have a need to reference two different versions of the Sharepoint API dll.  I have a webservice that needs to run under both Sharepoint 2 and Sharepoint 3, but also needs to work with new features provided by the Sharepoint 3 API (Checkout and Content Approval)</p>

<p>What is the best way to acheive this - I'm currently leaning towards having two projects, with the code in a single file shared between the two with various sections of the code compiled in using conditional compilation.</p>

<p>Is there a better way ?</p>

<p>Thanks</p>

<p>Matt</p>

You could give an "extern alias" a go.
This is one of those times when the VB late binding (option strict off) approach works well. Roll on C# 4.0 and
```
dynamic
```
.
You might try writing an interface for the bits you need (in a base library), and write 2 dlls: one referencing each version of the sharepoint dll. For both projects, implement the interface (throwing
```
NotSupportedException
```
for the bits you can't do), and load the appropriate dll at runtime? (factory approach)
Just try it with a single method before you get too absorbed... don't do the whole thing until you know it works for the simplest of simple methods.