无法将软件包添加到.Net核心控制台项目?

时间:2019-07-12 20:33:17

标签: c# visual-studio .net-core

我使用Visual Studio 2019 V16.1.6创建了一个新的C#.Net核心控制台项目。但是,Install-Package System.Data.SqlClient遇到以下错误?

以下操作是使用命令行完成的。

dotnet add package System.Data.SqlClient
  

编写C:\ Users \ user \ AppData \ Local \ Temp \ 1 \ tmp947F.tmp   info:将“ System.Data.SqlClient”包的PackageReference添加到项目“ C:\ Users .... \ MapE \ MapE.csproj”中。

     

info:恢复C:\ Users .... \ MapE \ MapE.csproj ...的程序包

     

info:获取https://api.nuget.org/v3-flatcontainer/system.data.sqlclient/index.json

     

info:确定https://api.nuget.org/v3-flatcontainer/system.data.sqlclient/index.json 144ms

     

错误:程序包System.Runtime.CompilerServices.Unsafe 4.5.0与netcoreapp2.1(.NETCoreApp,Version = v2.1)不兼容。软件包System.Runtime.CompilerServices.Unsafe 4.5.0支持:uap10.0.16300(UAP,Version = v10.0.16300)

     

错误:程序包'System.Data.SqlClient'与项目'C:\ Users .... \ MapE \ MapE.csproj'中的'所有'框架不兼容。

PS C:\temp> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.701
 Commit:    8cf7278aa1

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.701\

Host (useful for support):
  Version: 2.1.12
  Commit:  ccea2e606d

.NET Core SDKs installed:
  2.1.507 [C:\Program Files\dotnet\sdk]
  2.1.508 [C:\Program Files\dotnet\sdk]
  2.1.700 [C:\Program Files\dotnet\sdk]
  2.1.701 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
PM> Install-Package System.Data.SqlClient
Restoring packages for C:\Users\...\MapE\MapE.csproj...
Install-Package : NU1202: Package System.Runtime.CompilerServices.Unsafe 4.5.0 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package System.Runtime.CompilerServices.Unsafe 4.5.0 supports: uap10.0.16300 (UAP,Version=v10.0.16300)
At line:1 char:1
+ Install-Package System.Data.SqlClient
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

0 个答案:

没有答案