Unable to install Npgsql 4.1.2 package. application . NET Framework

Asked

Viewed 340 times

2

I’m trying to install the Npgsql to consume Postgresql data in my project , but returns me the error below:

Severity Code Description Project File Line Suppression State Error Could not install package 'Npgsql 4.1.2'. You are trying to install this package into a project that targets '. Netframework,Version=v4.5.2', 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.

I understand the mistake, but do not know how to treat. Researching on the internet I saw something related to Multi-targeting but I didn’t understand very well how to adapt in my project and/or if this is "safe" in making.

1 answer

2


This error occurs when the package has a dependency on a specific version of . NET Framework where your project does not have.

Your project is in version 4.5.2 and according to the package on the website Nuget, in the "Dependencies" option, your project needs to be in version 4.6.1.

You have two options depending on what you see viable for you:

1 - Change your project version to version 4.6.1 or later, navigating to the properties of your project, and in application "Target Framework", change to a current version.

inserir a descrição da imagem aqui

But beware, make sure you can actually make this change and if you won’t break anything of your project due to change.

2 - Install an older version of the package.

According to the Nuget package website, version 4.0.10 will need at least version 4.5.1, which you can install on your project without modifying the framework used.

However, because it is an older version of the package, it may not contain the latest improvements and be out of date with the latest updates.

You can find this version here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.