Referencing another project in .Net Core

一世执手 提交于 2020-01-01 04:48:07

问题


I have 6 projects in a blank solution. I just want to reference a project to another. I have HomeController in Blog.Web projects. I want to access another project's methods like IOrganizationService in Blog.Services projects. How can I use IOrganization's method in HomeController class? For clear insight, please see picture.

Red marks show the errors....


回答1:


It looks like you've created everything as web sites, but I suspect that most of those projects should actually be class libraries (dlls), not sites. You might need to reset a few things!

You should be able to right-click on the Dependencies node to add a project reference:

or the project node:

then:

Alternatively: edit the csproj and add a <ProjectReference> node:



来源:https://stackoverflow.com/questions/44651629/referencing-another-project-in-net-core

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!