'Dotnet restore not working

Update I: I just changed the project to run under target framework .NET Core v2.0 & sdk version 2.1.3 and I only get these kind of errors:

Severity Code Description Project File Line Suppression State Error NU1202 Package Microsoft.Extensions.FileProviders.Physical 1.1.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.Extensions.FileProviders.Physical 1.1.0 does not support any target frameworks. AspNetCoreExample C:\Users\Admin\Source\Repos\Examples\src\AspNetCoreExample\AspNetCoreExample.csproj 1

Update II:

While the following solves the current issue, i am not sure if it solves the root cause for this issue.

Delete the global nuget.config file %AppData%/Nuget/Nuget.config.

I fixed this issue by doing the following: I migrated the project to .net core 2.0 and changed the global.json to point to sdk 2.1.3. Removed all references in AspNetCoreExample manually and added the latest version for all of them.


Issues with target framework 1.1

When doing a restore from the solution in VS 2017:

enter image description here

When doing the restore from cmd (dotnet restore) enter image description here

Running dotnet restore in Package Manager Console

enter image description here enter image description here

NuGet.targets(103,5): error : Access to the path 'System.Runtime.dll' is denied

.NET Core SDKs installed: enter image description here

.NET Host enter image description here

Now when opening the solution I get:

enter image description here



Solution 1:[1]

Comparing the log entries you pasted to their AppVeyor build,

https://ci.appveyor.com/project/Autofac/examples

Your machine's NuGet configuration seems to be broken. Analyze that and fix the issues.

Solution 2:[2]

You should add this code to your .csproj file

<RuntimeFramework>2.0.3</RuntimeFramework>

This worked for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lex Li
Solution 2 Mehmet Can Ta?