140

I have a .net core 2.0 console app. I'm trying to read files from TFS using the following:

How to get a file from TFS directly into memory (i.e., don't want to read from file system into memory)?

I head over to nuget and install Microsoft.TeamFoundationServer.ExtendedClient and run into this:

enter image description here

Package 'Microsoft.AspNet.WebApi.Client 5.2.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.

Even after suppressing the warning, I still get the error and can't reference the library. How can I get this reference resolving?

Very easy to repro:

  1. New .net core 2.0 console app
  2. Copy the method from the above question
  3. Try to install the nuget package
8
  • 13
    The nuget package you are referring to is not compatible with .NET Standard (or .NET Core), so Visual Studio is trying to use the only available target framework (.NET 4.6.1), which (as said) may not be compatible with your target framework. Your app should compile even with this warning, but there is no guarantee that such library will work in .NET Core. Oct 17, 2017 at 19:50
  • @FedericoDipuma I understand that, but the project won't even compile and references won't resolve despite the warning being suppressed. Oct 17, 2017 at 19:58
  • 2
    You may try the standard Client package, which is currently in preview but is fully compatible with .NET Standard 1.6 (and thus with .NET Core 1.1+). It is not full-featured like the extended client but it may be enough for you. I do not believe you have alternatives right now. Oct 17, 2017 at 20:00
  • Checkout this, too: github.com/dotnet/standard/issues/439#issuecomment-321608375
    – Babak
    Nov 19, 2017 at 0:05
  • As Andy mentioned in answer, this is fixed in Microsoft.AspNet.WebApi.Client v5.2.4. Currently the pre-release version v5.2.4-preview1 is available in NuGet and is compatible with .NET Standard 2.0.
    – Arghya C
    Feb 5, 2018 at 16:19

3 Answers 3

35

The package is not fully compatible with dotnetcore 2.0 for now.

eg, for 'Microsoft.AspNet.WebApi.Client' it maybe supported in version (5.2.4). See Consume new Microsoft.AspNet.WebApi.Client.5.2.4 package for details.

You could try the standard Client package as Federico mentioned.

If that still not work, then as a workaround you can only create a Console App (.Net Framework) instead of the .net core 2.0 console app.

Reference this thread: Microsoft.AspNet.WebApi.Client supported in .NET Core or not?

1
  • I had a similar issue with "Microsoft.VisualStudio.Web.CodeGeneration.Design" and ".netcore 2.2", my solution was to find first more recent versions of the package to see if they resolved it, before going the other way with finding older packages till I found a compatible package. In my case I was using 3.1.0 and needed to roll back to the first preview of that version.
    – Myzifer
    Nov 10, 2021 at 11:47
4

For me, I had ~6 different Nuget packages to update and when I selected Microsoft.AspNetCore.All first, I got the referenced error.

I started at the bottom and updated others first (EF Core, EF Design Tools, etc), then when the only one that was left was Microsoft.AspNetCore.All it worked fine.

1
  • Indeed, on 2018.06.14 I was able to install and setup my environment for the first time, create the project, manually build and then debug the boilerplate code (with just one simple change); all without addressing that specific warning.
    – azarc3
    Jun 14, 2018 at 20:01
2

That particular package does not include assemblies for dotnet core, at least not at present. You may be able to build it for core yourself with a few tweaks to the project file, but I can't say for sure without diving into the source myself.

Not the answer you're looking for? Browse other questions tagged or ask your own question.