Reputation: 308
Here's the problem I'm facing, which I think only happens when using .net core and visual studio 2017
I have 3 projects in my solution.
ProjectA has a project reference to ProjectB and ProjectC has a project reference to ProjectA
Since ProjectC doesn't have explicit project reference to ProjectB, I shouldn't be able to refer to ProjectB's code in ProjectC. If I try to use any code from ProjectB in ProjectC I used to get compilation errors. But this is not the case anymore. My solution compiles successfully without any errors. Am I missing anything here ?
Upvotes: 2
Views: 760
Reputation: 1402
If you reference a project that has references to another project, those references will be automatically added. In your case when you have Project A with a reference to Project B, when you reference project A in project C reference to Project B will be automatically added.
If you would like to disable transitive reference behavior you can add PrivateAssets="All" to your reference in the ProjectA.csproj (WebProject)
<ItemGroup>
<ProjectReference Include="..\ClassLibrary1\ClassLibraryProject.csproj" PrivateAssets="All"/>
</ItemGroup>
Upvotes: 3