0

I have created a class library with the target framework .NETCoreApp 1.1 with some objects that are common among my classes.

In a second project, also a class library with the target framework .NETCoreApp 1.1 where I want to include the previous created project dll.

How can I do that? I tried to explicitly add the dll in the references, but when I build the second project I get the following error:

Cannot find project info for 'ProjectPath\ProjectFile.csproj'. This can indicate a missing project reference.

When I check the projects assemblies list I see my dll added there, without the yellow warning icon... What am I doing wrong?

EDIT:

I am currently using Visual Studio 2017.

And this is the csproj of my second project, the one giving the error:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="NLog.Web.AspNetCore" Version="4.3.1" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="Common">
      <HintPath>..\Common\bin\Release\netcoreapp1.1\Common.dll</HintPath>
    </Reference>
  </ItemGroup>
</Project>
3
  • Did you use any tooling to do that? VS, CLI, manual edit? also, what does your csproj file contain? Commented Apr 28, 2017 at 13:06
  • plus: if outside vs, did you run dotnet restore? Commented Apr 28, 2017 at 13:06
  • @MartinUllrich I am using Visual Studio 2017. Commented Apr 28, 2017 at 13:56

1 Answer 1

2

You added a "Reference" instead of a "Project Reference". You can correct this by replacing the last <ItemGroup> element with:

<ItemGroup>
  <ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup>
Sign up to request clarification or add additional context in comments.

3 Comments

That was the problem. Thank you.
I solved the problem I had, but a new one appeared, I have one Console application with the target framework .NETCoreApp 1.1, and I added both projects the same way you told me, as a project, and not as a single dll, the project compiles and runs, but at some point I get this exception: Could not load file or assembly 'Common Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. You know what can be wrong?
Oh never mind, I followed your other comment and ran dotnet restore and got it working. Thank you again.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.