Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Create nuget package while solution uses clean architecture

$
0
0

I have solution that uses clean architecture, so I have following projects:

  1. Core
  2. Application that depends on Core
  3. Infrastructure that depends on Application
  4. Web that depends on Application and Infrastructure

I need to create NuGet package so I have went to folder with my Web.csproj and I typed following command in PowerShell:.\nuget pack Web/Web.csproj -IncludeReferencedProjects

Seems that all should work, but when I install this NuGet package into another project I'm getting following warnings:

Warning NU1603 Web 1.0.0 depends on Infrastructure (>= 1.0.0) but Infrastructure 1.0.0 was not found. An approximate best match of Infrastructure 1.0.0.1 was resolved.

Warning NU1603 Web 1.0.0 depends on Application (>= 1.0.0) but Application 1.0.0 was not found. An approximate best match of Application 1.2.1 was resolved.

Warning NU1701 Package 'Infrastructure 1.0.0.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net7.0'. This package may not be fully compatible with your project.

All of above projects (Core, Application, Infrastructure, Web) uses NET 7. What's wrong with my NuGet package? How can I fix it?

These are my current .csproj:Web.csproj

<Project Sdk="Microsoft.NET.Sdk.Web"><PropertyGroup><TargetFramework>net7.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings><IsPackable>true</IsPackable><Version>1.3.2</Version></PropertyGroup><ItemGroup><ProjectReference Include="..\Application\Application.csproj" /><ProjectReference Include="..\Infrastructure\Infrastructure.csproj" /></ItemGroup></Project>

Application.csproj:

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>net7.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable></PropertyGroup><ItemGroup><PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" /><PackageReference Include="NSec.Cryptography" Version="22.4.0" /><PackageReference Include="Paseto.Core" Version="1.0.7" /></ItemGroup><ItemGroup><ProjectReference Include="..\Core\Core.csproj" /></ItemGroup>

Infrastructure.csproj:

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>net7.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable></PropertyGroup><ItemGroup><PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" /></ItemGroup><ItemGroup><ProjectReference Include="..\Application\Application.csproj" /></ItemGroup>

And the Core.csproj:

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>net7.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable></PropertyGroup><ItemGroup><PackageReference Include="Base64-Url" Version="1.0.0" /></ItemGroup></Project>

Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>