I'm a .NET newbie using VS Code while following an online course on Angular and .NET Core. The course requires the AutoMapper.Extensions.Microsoft.DependencyInjection package to be installed but I keep getting the following errors when I try install any package.
Unable to resolve <package_name> for '.NETCoreApp,Version=v2.2'
Package <package_name> is incompatible with 'all' frameworks in project <csproj_path>
I use the following command to install the package:
dotnet add package AutoMapper.Extensions.Microsoft.DependencyInjection
What I've tried so far:
It was working before when I tried to install the Microsoft.EntityFrameworkCore.Sqlite package at the beginning of the course and now for some reason I can't install any package.
Do note that I'm not able to use the NuGet extension as it's not working behind a corporate proxy.
Any help would be greatly appreciated :)
Description. The dotnet add package command provides a convenient option to add or update a package reference in a project file. When you run the command, there's a compatibility check to ensure the package is compatible with the frameworks in the project.
Set up Visual Studio In Visual Studio, select Tools, and then select Options. Select NuGet Package Manager, and then select Package Sources. Enter the feed's Name and Source URL, and then select the green (+) sign to add a new package source.
I finally fixed the issue by deleting the NuGet.Config file in C:\Users\<user>\AppData\Roaming\NuGet folder then running dotnet restore
Running dotnet restore created a fresh config file on the folder which i noticed has a different packageSources value than the old one.
The old one had https://www.nuget.org/api/v2/ while the new one had https://api.nuget.org/v3/index.json
I completely forgot that I have VS 2010 (with nuget) installed which was responsible for the old config file and I did not realize that nuget from the dotnet-cli was also using the same old configurations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With