Vic
Vic

Reputation: 517

How can I use netstandard2 using .net Framework 4.5?

I'm trying to install the package WebSocketSharp.Standard but I getting installing error.

Install-Package : Could not install package 'WebSocketSharp.Standard 1.0.3'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. At line:1 char:1

Install-Package WebSocketSharp.Standard -Version 1.0.3

CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

I download the NuGet and extract and I check the library only the netstandard2.0 enter image description here

how can I use the package in my current project? Im using VS2013.

Upvotes: 0

Views: 1835

Answers (1)

magicandre1981
magicandre1981

Reputation: 28836

.Net standard 2.0 support works starting with .net framework 4.6.1, but you get a lot of system DLLs next to your app. So use .net 4.8 and not 4.6.x.

The minimum requirement to use .net standard libs is to use Visual Studio 2015 (with the update 3 + a special hotfix), but it is better to use VS2017 or 2019:

If you only need to consume .NET Standard 2.0 libraries in your projects, you can also do that in Visual Studio 2015. However, you need NuGet client 3.6 or higher installed.

So your VS2013 is too old.

Upvotes: 2

Related Questions