"stand alone" class 文件如何工作?
How does a "stand alone" class file work?
我正在查看 /test/shared
文件夹中 Kestrel and found something interesting. From its dev branch, you can see there is a stand alone class file named HttpClientSlim 的源代码,该文件夹不属于任何项目。它被用在一些项目中。我克隆了源代码,解决方案资源管理器看起来像
如何编译?
当您尝试将现有项目添加到项目时,"Add" 按钮旁边会出现一个小下拉菜单,您可以通过它添加为 link。
这意味着如果您希望 class 包含在多个项目中,您可以将实际的源文件保存在一个地方,但 "link it in" 到多个项目。
它节省了 copy/pasteing 代码,但项目将其编译成二进制文件,就好像它是本地的。
请注意,对于 VS2015 的用户,您可能需要手动编辑 project.json
以获得相同的功能,这在 Q/A:
中有更详细的描述
我正在查看 /test/shared
文件夹中 Kestrel and found something interesting. From its dev branch, you can see there is a stand alone class file named HttpClientSlim 的源代码,该文件夹不属于任何项目。它被用在一些项目中。我克隆了源代码,解决方案资源管理器看起来像
如何编译?
当您尝试将现有项目添加到项目时,"Add" 按钮旁边会出现一个小下拉菜单,您可以通过它添加为 link。
这意味着如果您希望 class 包含在多个项目中,您可以将实际的源文件保存在一个地方,但 "link it in" 到多个项目。
它节省了 copy/pasteing 代码,但项目将其编译成二进制文件,就好像它是本地的。
请注意,对于 VS2015 的用户,您可能需要手动编辑 project.json
以获得相同的功能,这在 Q/A:
中有更详细的描述