4
votes

I've just created a new .NET Core web app (all defaults, no webapi or web application) and I get the following error:

Unexpected dependency 'System.Runtime.CompilerServices.Unsafe' with no version number.

1>------ Build started: Project: WebApplication1, Configuration: Debug Any CPU ------ 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(154,5): error : Unexpected dependency 'System.Runtime.CompilerServices.Unsafe' with no version number.

1>WebApplication1 -> c:\users\chris\documents\visual studio 2017\Projects\WebApplication1\bin\Debug\netcoreapp1.1\WebApplication1.dll

1>Done building project "WebApplication1.csproj" -- FAILED.

========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

This is a recent install of VS2017 with .NET core installed as part of it. If I follow the error it takes me to the above targets and complaints the two items below are undefined:

enter image description here

UPDATE:

I've tried everything up to and including a full uninstall and reinstall of VS 2017. This seems to be only happening with the .NET Core 1.1 templates, (even with updated nuget packages)

1
try to do a manual restore fron the dotnet console.Gusman
In the top of VS you may see a flag for some updates, I would apply all updates before creating the project. Then if you still get errors you can open a command window on the solution folder and try dotnet restore --no-cacheJoe Audette
@Gusman There are no updates, dotnet restore (and vs repair) didn't helpChrisFletcher
@JoeAudette No updates, dotnet restore (and vs repair) didn't helpChrisFletcher

1 Answers

4
votes

Eventually solved the problem by clearing out my c:\users\myname\ .nuget\packages folder and doing a fresh dotnet restore. I assume it was picking up an old version of a package I had back when I was doing beta .net core development a long time ago