RemarkLima
RemarkLima

Reputation: 12037

Visual Studio update 2017 15.3.1 forces ASP.NET Core SDK 2.0, which then doesn't find "reference assemblies"

Related to this question: Visual Studio 15.3.1 can't find core DLLs after update

I've had to do the same process, a corrupt VS settings meant I ran the installer and updated VS 2017 to 15.3.1. Since then, my main project wouldn't run without having the .NET Core SDK 2.0 installed, like in the referenced question above.

I've installed the SDK 2.0, which resolved the error, the project builds and run but then immediately throws InvalidOperationException: Can not find assembly file Microsoft.CSharp.dll at 'build paths'

If I drop that DLL from my C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1 directory (I'm using a .NET Core app targeting the full framework 4.6.1) into the bin folder, it then moves onto mscorelib.dll that's missing, and then on-and-on.

Before just dumping the whole lot into the bin output folder, I'm assuming that for some reason the new setup doesn't find the new SDK files and / or reference assemblies folder?

Is there a fix for this? That will also reflect into production environments.


There's the same issue on GitHub here: https://github.com/aspnet/Home/issues/2129 which links to https://github.com/dotnet/sdk/issues/1488

The issue is the same, nothing has been upgraded - only VS updated to 15.3.1, which has then thrown the The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. error with no other changes to the project

Upvotes: 3

Views: 1708

Answers (1)

RemarkLima
RemarkLima

Reputation: 12037

After spending the day on this, as per the linked GitHub issue here: https://github.com/dotnet/sdk/issues/1488 the current solution is to add the following to your .csproj file, in the main <PropertyGroup> node:

<DependsOnNETStandard>netstandard1.5</DependsOnNETStandard>

There's some more information on what to target here: https://learn.microsoft.com/en-us/dotnet/standard/net-standard

It may be only for .netcore projects, targeting the full framework (4.6.1 in this case), when you update to VS 2017 15.3 and above.

If a better fix comes along, I'll update the answer to reflect it.

Upvotes: 4

Related Questions