AddAutoMapper not found in .NET Core with AutoMapper - automapper

Using Visual Studio 2019 I installed AutoMapper version 8.1.0 via NuGet. When I try to add the services.AddAutoMapper() call though in my Startup.cs file I get a compiler error that the method doesn't exist.
I've already tried to do a dotnet clean and dotnet restore from the NuGet console but that didn't help.

It is an old thread, however the solution for this problem is to install Automapper.Extensions.Microsoft.DependencyInjection package along with your automapper package.
I hope it helps.

Related

Could not load file or assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.22.0

I have recently cloned a new repository which has AzureFunctions but I am unable to run it. The build succeeds and on Run click it opens a window suggesting that it is downloading Azure
I am using VS2017 and .Net core 2.1.
It seems to be working for other team members but not for me.
I keep getting this 'Could not find Azure.WebJobs.Host...' error continuously.
I've tried all the fixes that are there on the internet without any luck.
The Azure Functions and Web job tools dlls seem to be up-to-date as they are not shown in the updates tab.
Updating all the nuget dependencies also did not work.
I tried using VS2017 and .Net core 2.1.
Installed Microsoft.Azure.WebJobs - 3.022 version from Nuget Packages.
Included Namespace
using Microsoft.Azure.WebJobs.Host;
I found that there is no Microsoft.Azure.WebJobs.Host direct assembly to include.
If you install Microsoft.Azure.WebJobs you can directly use Microsoft.Azure.WebJobs.Host namespace.
Check your .csproj , if you have any PackageReference Included with Microsoft.Azure.WebJobs.Host, try to remove and build your Application.
It must include Microsoft.Azure.WebJobs

Can't install M2MQTT Nuget package to Xamarin.iOS

When installing the Nuget package for M2MQTT 4.3 to my Xamarin.iOS project, I get the following error:
Could not install package 'M2Mqtt 4.3.0'. You are trying to install
this package into a project that targets 'Xamarin.iOS,Version=v1.0',
but the package does not contain any assembly references or content
files that are compatible with that framework.
However, 4.2 works fine. I have seen this error pop up for some other packages too, and my Nuget is up to date. This error shows up when I try to install in VS2017 on Windows and also on Visual Studio for Mac.
Should it be possible to build the package myself from source, and if so, what do I need to change to make it compatible (assuming that the library doesn't actually use part of .NET that Xamarin.iOS doesn't support)?
The reason I need to update is that on 4.2 I get the following error when trying to create a MqttClient:
The type 'IPAddress' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System, Version=3.9.0.0...'
and my hope is that this error will be resolved in the newest version.

Add Tweetinvi to mono without nuget

I had to make a .NET project in Linux using monodevelop. When I tried monodevelop in Ubuntu I got an error message when I used nuget at certain packages saying my version is 2.8 and I needed 2.12 or earlier.I updated nuget package successfully in terminal but monodevelop uses 2.8 no matter what I do. The nuget package I can't use because of this is Tweetinvi.
In order to solve this I have to either add tweetinvi without using nuget or manage to use nuget 2.12 running from outside monodevelop, which I could not find out how to do.
https://github.com/linvi/tweetinvi
MonoDevelop does not use the NuGet version supplied by Mono that is available from the command line. So updating the command line version of NuGet will not resolve any problems with MonoDevelop.
More recent versions of MonoDevelop use later versions of NuGet.
The last MonoDevelop version 5 release was version 5.10 which supports NuGet 2.8.7.
Support for MonoDevelop 2.12 was added in MonoDevelop 6.0.2. NuGet v3 support was added in MonoDevelop 6.1. Currently MonoDevelop 6 is only available as a FlatPak package unless you build it from source.
If you cannot build MonoDevelop from source you may be able to upgrade NuGet by copying the NuGet.Core.dll from the mono/nuget-binary GitHub repository and copying it into the NuGet addin directory addins/MonoDevelop.PackageManagement, but take a backup copy of the original NuGet.Core.dll before you do that so you can rollback the change if it does not work.
I am the developer of the library and the installation of the library without nuget is not supported on mono because I do not have enough time to look into it.
Tweetinvi supports mono > 4.5 with nuget.

How to upgrade nuget packages if the installed version is missing?

Running into a situation where I deployed an application to production a few months ago and now I need to do some work on it, on an entirely new machine. The first I do is pull source and nuget restore won't restore because it can't find the particular version of the package it was developed under. When I check nuget.org for this package version it is not there. So how do I upgrade my solution to the latest binaries?
Visual Studio 2013 trying to update ServiceStack '4.0.39' to latest, which is '4.0.40' at the time of this post.
Thank you,
Stephen
The best solution I've come up with for this is to manually edit the Packages.config file(s) and set the version number to whatever you want. Restore should then work. It's not a perfect solution but it has dug me out of some holes.
(I know this is an old answer, but it just came up in some Googling)
One issue with the accepted answer (of just updating the version # in packages.config) is that this is just triggering a "package restore"--and will skip any "installation steps" the package might have (things that were done automatically when you first added the package, such as adding assembly references, modifying config files, etc.).
An alternative way would be to edit the packages.config and REMOVE the package in question from there---then start up VS and add the new version. This will trigger the package's usual install routine to do it's thing.
I recommend you to use the NuGet Package Manager Console of Visual Studio:
TOOLS > NuGet Package Manager > Package Manager Console
Command to update a NuGet package to the latest version:
Update-Package ServiceStack
Command to update a NuGet package to a specific version:
Update-Package ServiceStack -version 4.0.40

VS2012 update1 breaks roslyn CTP3 (September CTP)

After installing VS2012 CTP1, the C# interactive throws an error like below:
Value cannot be null.
Parameter name pSrcNativeVariant
I tried uninstall and reinstall Roslyn CTP but with no success. Any idea?
It seems that I have to answer my own question, once again:). I today found out that actually it's that Mono for Android plugin for VS2012 is the culprit. After uninstalling it, Roslyn is back to normal.

Resources