Reputation: 13592
These are my project layers:
.NET Core 2.0 Web Project: UILayer
.NET Standard Class library : BusinessLayer
.NET Standard Class library : DataAccessLayer
I add the reference of BusinessLayer to UILayer and the reference of DataAccessLayer to BusinessLayer
So I expected the layers just had access to the those dlls, that are referenced. But now I see the UILayer has access to DataAccessLayer! Why? And how could I prevent that? (I mean physically not just logically)
It seems it is new in .NET Core I can't see the same functionality with .NET Framework 4.6.1 class libraries. So another question is that why it is added in ASP.NET Core projects? Is there any advantages? If I want to access the project simply I could add the reference.
Upvotes: 4
Views: 1051
Reputation: 2413
You can specify that inside the .csproj of your BusinessLayer project, use the <PrivateAssets>
element inside the <ProjectReference>
to declare the assets that you do not want to be visible for parent projects.
Here you have additional info for this element
<ProjectReference Include="{path-of-your-referenced-DataAccessLayer}">
<PrivateAssets>All</PrivateAssets>
</ProjectReference>
Upvotes: 5