Compile a version agnostic DLL in .NET

前端 未结 5 681
無奈伤痛
無奈伤痛 2020-12-05 01:14

Scenario

I have two wrappers around Microsoft Office, one for 2003 and one for 2007. Since having two versions of Microsoft Office running side by side is \"not of

5条回答
  •  我在风中等你
    2020-12-05 01:54

    Just a thought - could you use TlbExp to create two interop assemblies (with different names and assemblies), and use an interface/factory to code against the two via your own interface? Once you have the interop dll, you don't need the COM dependency (except of course for testing etc).

    TlbImp has a /asmversion for the version, so it could be done as part of the build script; but I'm sure you even need this: just make sure that "specific version" is false in the reference (solution explorer)?

    Also - I know it doesn't help, but C# 4.0 with dynamic and/or "No PIA" might help here (in the future; maybe).

提交回复
热议问题