I have a Class Library that is supposed to be packed into a nuget package. This is its current csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.6;net40;netcoreapp1.0</TargetFrameworks>
<PackageId>FooPackage</PackageId>
<PackageVersion>1.0.0</PackageVersion>
<Authors>Jean Lourenço</Authors>
<Title>FooPackage</Title>
<Description>FooPackage</Description>
<Copyright>Copyright 2017</Copyright>
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/</PackageProjectUrl>
<PackageReleaseNotes>Initial release</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="4.3.1" />
</ItemGroup>
I created it as a netstandard Class Library and then manually set the <TargetFrameworks>
to its targets netstandard1.6;net40;netcoreapp1.0
. Then I use dotnet pack
to generate my .nupkg
.
But when I try to use the package in a netcoreapp
, this happens:
Package FooPackage 1.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package FooPackage 1.0.0 supports: net452 (.NETFramework,Version=v4.5.2)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
This is the csproj of the consuming app:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
</Project>
The net452
isn't even referenced directly into the <TargetFrameworks>
, so I have no idea where that is coming from.
I'd like to know what I'm doing wrong and how to target those frameworks correctly.
Following the instructions on this thread all I had to do was:
nuget.exe locals -clear all
Seems like the nuget kept old references of the package because of the name.