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

dotnet pack warning NU1701 (TargetFramework warning) which followed by CS0234 (missing assembly reference)

$
0
0

I am writing a NuGet package which is to be referenced from another project. Both frameworks are .NET 6.0, OS=Ubuntu. Both projects define <TargetFramework>net6.0</TargetFramework> in .csproj.

  • When I pack the NuGet package, all is okay (no errors, no warnings)

  • When I try to restore the .nupkg, in I get a NU1701 warning:

    warning NU1701: Package 'TestCore 1.0.0' 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' instead of the project target framework 'net6.0'. This package may not be fully compatible with your project.

  • When I try to run my code, I get a CS0234 (Error):

    The type or namespace name 'Core' does not exist in the namespace 'Verisoft' (are you missing an assembly reference?)

Nuget Package's .csproj:

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><PackageId>TestCore</PackageId><Version>1.0.0</Version><Authors>Nir Gallner</Authors><Company>VeriSoft</Company><TargetFramework>net6.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><IsPackable>true</IsPackable><GeneratePackageOnBuild>true</GeneratePackageOnBuild></PropertyGroup><ItemGroup><PackageReference Include="Allure.Commons" Version="3.5.0.73" /><PackageReference Include="log4net" Version="2.0.14" /><PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /><PackageReference Include="Microsoft.Playwright.NUnit" Version="1.22.0" /><PackageReference Include="NUnit" Version="3.13.3" /><PackageReference Include="Nunit.Allure" Version="1.2.1.1" /><PackageReference Include="NUnit3TestAdapter" Version="4.2.1" /><PackageReference Include="NUnit.Analyzers" Version="3.3.0" /><PackageReference Include="coverlet.collector" Version="3.1.2" /><PackageReference Include="RestSharp" Version="108.0.1" /></ItemGroup></Project>

Consuming project's .csproj:

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>net6.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><IsPackable>false</IsPackable></PropertyGroup><ItemGroup><PackageReference Include="Allure.Commons" Version="3.5.0.73" /><PackageReference Include="log4net" Version="2.0.14" /><PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /><PackageReference Include="Microsoft.Playwright.NUnit" Version="1.22.0" /><PackageReference Include="NUnit" Version="3.13.3" /><PackageReference Include="Nunit.Allure" Version="1.2.1.1" /><PackageReference Include="NUnit3TestAdapter" Version="4.2.1" /><PackageReference Include="NUnit.Analyzers" Version="3.3.0" /><PackageReference Include="coverlet.collector" Version="3.1.2" /><PackageReference Include="RestSharp" Version="108.0.1" /><PackageReference Include="NUnit.ConsoleRunner" Version="3.15.2" /><PackageReference Include="TestCore" Version="1.0.0" /></ItemGroup><ItemGroup><None Update="allureConfig.json"><CopyToOutputDirectory>Always</CopyToOutputDirectory></None><None Update="log4net.config"><CopyToOutputDirectory>Always</CopyToOutputDirectory></None></ItemGroup><ItemGroup><Reference Include="TestCore"><Path>./TestCoreBuilds</Path></Reference></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>