问题描述
在 .NET Core 1.1 和 Visual Studio 2017 RC 中开发示例 Web 应用程序时,我意识到以下几点:
While developing a sample web app in .NET Core 1.1 and Visual Studio 2017 RC, I realized the following:
如您所见:
- ClassLibrary3 引用了 ClassLibrary2,
- 并且 ClassLibrary2 引用了 ClassLibrary1
我在 ClassLibrary3 项目的 Class3 类中写了一个简单的方法,Intellisense 允许我使用 Class1 只写类名,我的意思是,没有明确引用 ClassLibrary1 项目.
I wrote a simple method in class Class3 of ClassLibrary3 project, and the Intellisense allowed me to use Class1 just writing the name of the class, I mean, without doing an explicit reference to ClassLibrary1 project.
我在这里遗漏了什么吗?我不希望有人只是来忽略 ClassLibrary2.
Am I missing some point here? I don't want somebody simply comes and overlooks ClassLibrary2.
谢谢.
推荐答案
项目到项目的传递引用是 Visual Studio 2017 和 Microsoft.NET.Sdk 的新功能.这是故意行为.
Transitive project-to-project references are a new feature of Visual Studio 2017 and Microsoft.NET.Sdk. This is intentional behavior.
参见 https://github.com/dotnet/sdk/issues/200.
这篇关于.Net Core 1.1 中的传递引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!