如何使用 .net Framework 4.5 使用 netstandard2?
How can I use netstandard2 using .net Framework 4.5?
我正在尝试安装软件包 WebSocketSharp.Standard,但出现安装错误。
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
我下载了 NuGet 并解压,我只检查了 netstandard2.0 库
如何在当前项目中使用该包?我正在使用 VS2013。
.Net standard 2.0 支持从 .net framework 4.6.1 开始工作,但你会得到很多 。所以使用 .net 4.8 而不是 4.6.x.
minimum requirement to use .net standard libs is to use Visual Studio 2015 (with the update 3 + a special hotfix),不过还是用VS2017或者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.
所以你的VS2013太旧了
我正在尝试安装软件包 WebSocketSharp.Standard,但出现安装错误。
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
我下载了 NuGet 并解压,我只检查了 netstandard2.0 库
如何在当前项目中使用该包?我正在使用 VS2013。
.Net standard 2.0 支持从 .net framework 4.6.1 开始工作,但你会得到很多
minimum requirement to use .net standard libs is to use Visual Studio 2015 (with the update 3 + a special hotfix),不过还是用VS2017或者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.
所以你的VS2013太旧了