How to reference two versions of an API?

后端 未结 2 1455
心在旅途
心在旅途 2020-12-16 04:28

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

2条回答
  •  眼角桃花
    2020-12-16 05:31

    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.

提交回复
热议问题