简体   繁体   中英

Failed to install Npgsql (Visual Studio Code)

I'm having trouble with installing Npgsql in Visual Studio Code (.Net Core 3.1.1).

I create a clean project and try install package. dotnet new console dotnet add package Npgsql --version 4.1.2

The package fails to install and I receive a message:

The Npgsql package is not compatible with all architectures in the project.. I found a similar problem here, but it was solved by updating NuGet. Which probably won't be my case. What am I doing wrong and how to install the package?

Problem solved. Installing a package using the dotnet add package package-name command does not work for me. But if I install the NuGet Gallery extension (in the VS code) and add a package using this tool, then the library will install properly.

May be you need to provide more details about the environment, the platform you are using. I tried creating the same on windows 10 with dot net 3.1.100 and it added the package successfully using visual studio code and VS 2019.

<Project Sdk="Microsoft.NET.Sdk">

   <PropertyGroup>
      <OutputType>Exe</OutputType>
      <TargetFramework>netcoreapp3.1</TargetFramework>
   </PropertyGroup>

   <ItemGroup>
      <PackageReference Include="npgsql" Version="4.1.2" />
   </ItemGroup>

</Project>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM