Referencing another project in .Net Core

前端 未结 2 1480
生来不讨喜
生来不讨喜 2021-02-07 12:32

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

相关标签:
2条回答
  • 2021-02-07 13:16

    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:

    0 讨论(0)
  • 2021-02-07 13:16

    Edit your MyProject.csproj file. And add a new ItemGroup or add your package into an existing ItemGroup. Here's example:

      <ItemGroup>
        <PackageReference Include="Polly" Version="7.2.0" />
        <ProjectReference Include="..\SomeOtherProject\SomeOtherProject.csproj" />
      </ItemGroup>
    
    0 讨论(0)
提交回复
热议问题