dotnet restore unable to resolve .NET Framework libraries (4.5.2, 4.6.2)
See original GitHub issueSteps to reproduce
In Visual Studio 2015
- Create a new ASP.NET Core Web Application (.NET Framework)
- Add a regular Class Library to the solution
- Add a reference to the new class library (in my case .NET Framework 4.6.2) from the web app
- 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:
- Created 7 years ago
- Reactions:42
- Comments:81 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
PLEASE FIX IT ASAP!
I cannot integrate any code in my ASP.Net Core (.Net Framework) application.
All work is stopped!
The
nuget
implementation inside of CLI in ourpreview2
tooling, as well as the CLI itself, does not know how to reason aboutcsproj
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].