Multi level project reference using dll

51 views Asked by At

Adding multi level project reference(Project1 referenced in Project2 & Project2 is reference in Project3) allows accessing the methods/namespace of level1(i.e. Project1) in level3(i.e.Project3).

But adding a dll reference(browse dll file instead of project reference) in Project3 instead allow access to only Project2 namespace and not Project1. Why?

Below is the scenario

I have a .NET Framework 4.8 class library project (ChildProject1) in Solution1. I need to use this class library in my .NET Core app (.NET 6.0 or .NET 8.0) in Solution2.

The requirement is such that I need to reference it as .NET Standard 2.0.

Note: I couldn't convert/upgrade to NS2.0 directly since Solution1 is a WPF application.

So I created a new project (class Lib targetting NS2.0) in Solution1 which has project reference to ChildProject1. Named this new project as ChildProjectWrapper. Build this project and copied the dll to .NET Core app (created a new folder in my project in Solution2 and copied only the ChildProjectWrapper.dll)

Now I added dll reference in Solution2 pointing to this folder and tried to reference the method in ChildProject1. Obviously I could reference the ChildProjectWrapper namespace, but couldn't reference the methods or namespace in ChildProject1.

What am I missing?

Thanks,

PRI

0

There are 0 answers