Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NU1701 warning when referencing Autofac 4.6.2 from netcoreapp2.0 project #902

Closed
YakhontovYaroslav opened this issue Mar 19, 2018 · 2 comments

Comments

@YakhontovYaroslav
Copy link

YakhontovYaroslav commented Mar 19, 2018

Since latest VS 2017 update (15.6.2) referencing Autofac 4.6.2 from netcoreapp2.0 package gives NU1701 warning on build:
warning NU1701: Package 'Autofac 4.6.2' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.

This is also true for visual studio generated docker images for ASP.NET Core 2.0.

It seems that this warning is "safe to ignore", assuming Autofac uses very small subset of .NET APIs, but there are many build envirinments or policies that enforces full NoWarn builds with no exceptions.

Example of csproj:

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Autofac" Version="4.6.2" />
  </ItemGroup>

</Project>

This issue is related to #867 , #889 and this PR: #868 .

@tillig tillig changed the title Release netstandard2.0 version of Autofac packages family. NU1701 warning when referencing Autofac 4.6.2 from netcoreapp2.0 project Mar 19, 2018
@tillig
Copy link
Member

tillig commented Mar 19, 2018

Updated the title to reflect the issue rather than the proposed solution.

At first blush this seems like a NuGet bug. netstandard1.1 is 100% compatible with netcoreapp2.0 so if it's being restored using some sort of net461 then NuGet isn't restoring using the right target framework.

#867 isn't related here unless the reason NuGet is failing is due to the .NET Core SDK build tooling from the 1.1.0 SDK. Note the .NET Core SDK is not related to the netstandard1.1 being targeted, one of the reasons the SDK is now separately versioned from the .NET Core runtimes.

#889 also doesn't relate because the proposal is effectively to target netstandard2.0 as well as netstandard1.1 simply to avoid transitive dependencies some people find distasteful.

I will see if I can reproduce the issue locally.

@tillig
Copy link
Member

tillig commented Mar 19, 2018

Given the exact project file posted above I am unable to reproduce this issue. No warnings appear, everything builds fine both in Visual Studio 2017 15.6.2 and from dotnet build in the application folder.

I would recommend:

  • Delete your .vs folder, the bin folder, and the obj folder from the source location.
  • Clear out your temp files folder.
  • Flush your NuGet cache: nuget locals all -clear

...then try again. Many times these sorts of things pop up after a VS upgrade due to something stale getting cached incorrectly. Flushing cached areas can sort it out.

@tillig tillig closed this as completed Mar 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants