question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet restore unable to resolve .NET Framework libraries (4.5.2, 4.6.2)

See original GitHub issue

Steps to reproduce

In Visual Studio 2015

  1. Create a new ASP.NET Core Web Application (.NET Framework)
  2. Add a regular Class Library to the solution
  3. Add a reference to the new class library (in my case .NET Framework 4.6.2) from the web app
  4. run dotnet restore from the command line

Expected behavior

dotnet restore completes without errors.

Actual behavior

The command terminates with the following error message:

Errors in C:\Users\xyz\Documents\Visual Studio 2015\Projects\WA-net\src\WebApplication1\project.json
    Unable to resolve 'ClassLibrary1' for '.NETFramework,Version=v4.5.2'.

In Visual Studio I can restore the packages and compile the application without any problem.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview1-002702)

Product Information:
 Version:     1.0.0-preview1-002702
 Commit Sha:  6cde21225e

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10240
 OS Platform: Windows
 RID:         win10-x64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:42
  • Comments:81 (5 by maintainers)

github_iconTop GitHub Comments

15reactions
hardhubcommented, Jun 22, 2016

PLEASE FIX IT ASAP!

I cannot integrate any code in my ASP.Net Core (.Net Framework) application.

All work is stopped!

13reactions
TheRealPiotrPcommented, Aug 4, 2016

The nuget implementation inside of CLI in our preview2 tooling, as well as the CLI itself, does not know how to reason about csproj files directly. In fact, the csproj/xproj concepts get layerd on top of project.json. This discrepancy is representative of why the team is now focused on Changes to the project model.

At the moment we have two options for interacting with these sorts of mixed models. First, we can use Visual Studio which understands csproj and xproj. Though I haven’t tried myself, I expect this should scale to building the project at the command line using MSBuild. The second approach is to build the csproj-based binaries and wrap them in NuGet packages, referencing those nuget packages from project.json.

Unfortunately, the current iteration of CLI is not capable of building .csproj projects, so a completely CLI-based approach is not available [yet].

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet restore unable to resolve .NET Framework libraries ...
It works in Visual Studio but not when using the dotnet CLI. My class library targets .NET 4.6.1. Error: "Unable to resolve 'MyCompany.MyProject ......
Read more >
TFS Build with dotnet restore and 4.5 Project
No workaround for this situation, you have to run dotnet restore. ... dotnet restore unable to resolve .NET Framework libraries (4.5.2).
Read more >
Troubleshoot .NET Framework targeting errors
To resolve the error, make sure that your application targets a .NET version that's compatible with the version that's targeted by the projects ......
Read more >
Runtime Changes for Migration from .NET Framework 4.5 ...
NET Framework 4.6, DynamicBase will return a stable result between different instances of an app running, and between different app domains.
Read more >
dotnet restore command - .NET CLI
Learn how to restore dependencies and project-specific tools with the dotnet restore command.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found