0

I have a .net solution consisting of 3 projects

  • myproject.Interfaces
  • myproject.Models
  • myproject.Core

When I create a NuGet on myproject.Core:

dotnet pack c:\Dev\myproject.Core.csproj -c Release

and try to install it in another project it's saying that

I'm missing .Models and .Interfaces.

Is there a way to include myproject.Models and myprojects.Interfaces within .Core NuGet? so that I have to install ONLY .Core nuGet in my projects?

ShaneKm
  • 20,823
  • 43
  • 167
  • 296
  • 1
    Does this answer your question? [Build NuGet Package automatically including referenced dependencies](https://stackoverflow.com/questions/16173568/build-nuget-package-automatically-including-referenced-dependencies) – PMerlet Jun 07 '21 at 14:36

1 Answers1

0

if your dependency is a nuget package you can add a dependency tag in your nuspec file

<dependencies>
      <group targetFramework=".NETCoreApp3.0" >
         <dependency id="myproject.Interfaces" version="3.0.1" />
         <dependency id="myproject.Models" version="3.0.1" />
      </group>
      <group targetFramework=".NETCoreApp3.1" >
         <dependency id="myproject.Interfaces" version="3.0.1" />
         <dependency id="myproject.Models" version="3.0.1" />
      </group>
    </dependencies>

but if your dependency is a dll you can add as a normal file

<files>
 <file src="lib\netcoreapp3.0\myproject.Interfaces.dll" target="lib\netcoreapp3.0\myproject.Interfaces.dll" />
 <file src="lib\netcoreapp3.0\myproject.Models.dll" target="lib\netcoreapp3.0\myproject.Models.dll" />
   
 <file src="lib\netcoreapp3.1\myproject.Interfaces.dll" target="lib\netcoreapp3.1\myproject.Interfaces.dll" />
 <file src="lib\netcoreapp3.1\myproject.Models.dll" target="lib\netcoreapp3.1\myproject.Models.dll" />
</files>
Katana
  • 752
  • 4
  • 23