Create new assembly - Application.Common.dll and place here your base
class. Then add reference to created assembly into both projects;
Application and Service. The Application.Common assembly will share base
functionality between two other projects.
--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com [quoted text, click to view] Walter Fettich wrote:
> I have the following problem:
>
> I have two assemblies:
>
> An exe: Apllication.exe
>
> and a dll: Service.dll
>
> What I want to do is load the dll in my exe dynamically using Assembly.Load
> and create an object of type Service.Service1.
>
> The problem is that the class Service.Service1 is derived from class
> Serivce.ServiceCommon which is also known to Application (the first
> assembly). When I try to cast Service.Service1 to Service.ServiceCommon i
> get an invalid cast exception even if I know it is valid because it is
> derived from that type. It must be a problem because the CLR believes
> Service.ServiceCommon to be different for each assembly even if it has the
> same body.
>
> Does anyone know of a better solution to use a common type in two assemblies
>