We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

# Has anyone seen an error while updating Xamarin.Essentials 1.3.1 to 1.4.0

GBMember ✭✭✭

While trying to update Xamarin.Essentials using the nuget package manager, I get the following error:

**
Has anyone seen this?

• GBMember ✭✭✭

It seems the answer - or at least a workaround - is to first uninstall the package. Re-adding it to the project then works fine.

Weird!

• GBMember

I was having this issue and resolved it by upgrading to using packages references instead of packages.config (From visual studio you can right-click on the packages.config files and select Upgrade to Package Reference).

My solution was in an odd state where my shared project was on package reference and some of my apps (the recently made ones) consuming it were package reference. Older projects on packages.config couldn't update the NuGet package.

• Member ✭✭✭

@Joebluhale I fixed. This error happens actually in the iOS project(at least for me anyways). The main idea of what you have to do is MIGRATE from packages.config to PackageReference.

Step 1: In Visual Studio go Tools/NuGet Package Manager/Package Manager Settings and under Package Sources choose PackageReference instead of packages.config.

This is the part that was not explained properly:

Step 2: Go to Solution Explorer and choose View All Files. In your iOS project or iOS extension project somewhere you should see this packages.config file, it should be in the root of one of your projects. I cant see mine anymore but what you have to do is right click on it and choose Migrate to PackageReference so it would migrate associated packages to PackageReference. A simple switch in the settings is not enough, have to do the migration. A dialog will pop up to confirm and it will do that for you and will redirect to a page with potential errors or let you know everything was successful.

After you do this, you update Xamarin Essentials no problem to latest version.

https://devblogs.microsoft.com/nuget/migrate-packages-config-to-package-reference/

Let me know if it worked.

• GBMember ✭✭✭

It seems the answer - or at least a workaround - is to first uninstall the package. Re-adding it to the project then works fine.

Weird!

Working on a branch to do the same, let you know if I run into this.

Never noticed this, I did have to bump two platform specifics manually but I think that's some dependency weirdness in our solution or because of Essentials Interfaces.

• GBMember ✭✭✭
edited February 26

@NMackay

I'm definitely having a problem with this. I left my PC for 20 minutes and now - without touching a line of code - the build is broken, saying it can't resolve the reference to Xamarin.Essentials.

Weirdly, at exactly the same time, it started saying it can't find a PNG graphic file I have as an iOS resource.

I'm wondering if this is a cache thing?

I have got the app to build by removing the PNG resource and removing all references to Xamarin.Essentials, but, as I require the latter, this is clearly only a temporary get-me-home fix.

Any advice would be very much appreciated.

• Patrick

Latest Update: Tried reverting to Xamarin.Essentials 1.3.1. The nuget package manager gives the following error:

Warning Could not resolve this reference. Could not locate the assembly "Xamarin.Essentials, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

Why is it looking for V1.0.0.0?

I reverted the changes in my branch so I never got this far unfortunately

• USMember ✭✭

I also get the error when trying to install version 1.5.0. I tried removing the package and then reinstalling and still idn't work.

Failed to add reference. The package 'Xamarin.Essentials' tried to add a framework reference to 'System.Drawing.Common.dll' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

• GBMember ✭✭✭

@thedee

Yes, I have just tried that and I get exactly the same error.

Could any of the Xamarin guys take a look at this?

• GBMember ✭✭✭

@thedee

A workaround again seems to be to remove Xamarin.Essentials from the solution in the nuget package manager and then re-add V1.3.1. I am unable to add any later versions.

Of course, this workaround assumes your application is not using anything in the later versions.

• Member ✭✭

Hi,
I try to upgrade from version 1.3.1 to 1.5.0 and get the same error. I removed Xamarin.Essentials from the solution and tried to reinstall version 1.5.0, but without any success.
Is there a solution for this problem? The message is:

Error       Failed to add reference. The package 'Xamarin.Essentials' tried to add a framework reference to 'System.Drawing.Common.dll' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.
Unbekannter Fehler (Exception from HRESULT: 0x80004005 (E_FAIL))

• USMember

I'm having the same issue. I've tried everything that others have mentioned but nothing works to allow me to install 4.0 or 5.0 on iOS. It installs to the Android and Shared projects just fine. So frustrating!!!

• GBMember

I was having this issue and resolved it by upgrading to using packages references instead of packages.config (From visual studio you can right-click on the packages.config files and select Upgrade to Package Reference).

My solution was in an odd state where my shared project was on package reference and some of my apps (the recently made ones) consuming it were package reference. Older projects on packages.config couldn't update the NuGet package.

• USMember, Beta ✭✭
edited April 9

I have the same problem with the IOS project in my solution. I cannot update beyond 1.3.1. i uninstalled the package and reinstalled xamarin essentials and proceeded to update one version at a time the error start at 1.4. how can this be resolved? none of the solutions above has worked in my case

• Member ✭✭✭

Did anyone find a solution? I am having the same problem. Why so many bugs lately in Xamarin?

• USMember

@Cdn_Euro said:
Did anyone find a solution? I am having the same problem. Why so many bugs lately in Xamarin?

I have the exact same questions/issues. None of the accepted answers here has helped. I cant uninstall because it isn't installed anymore. The packages. reference thing doesn't work.

• Member ✭✭✭

@Joebluhale I fixed. This error happens actually in the iOS project(at least for me anyways). The main idea of what you have to do is MIGRATE from packages.config to PackageReference.

Step 1: In Visual Studio go Tools/NuGet Package Manager/Package Manager Settings and under Package Sources choose PackageReference instead of packages.config.

This is the part that was not explained properly:

Step 2: Go to Solution Explorer and choose View All Files. In your iOS project or iOS extension project somewhere you should see this packages.config file, it should be in the root of one of your projects. I cant see mine anymore but what you have to do is right click on it and choose Migrate to PackageReference so it would migrate associated packages to PackageReference. A simple switch in the settings is not enough, have to do the migration. A dialog will pop up to confirm and it will do that for you and will redirect to a page with potential errors or let you know everything was successful.

After you do this, you update Xamarin Essentials no problem to latest version.

https://devblogs.microsoft.com/nuget/migrate-packages-config-to-package-reference/

Let me know if it worked.

• USMember ✭✭

Excellent @Cdn_Euro! After several trials, finding this post helped me immediately. Thanks!

• GBMember ✭✭✭

This is maybe a touch off-topic but not much.

I have moved over to the newer PackageReference system and my solution was building fine. Today, I tried to install a new nuget package (Microcharts) and something broke with this because I found I couldn't access any of the types in my source files, even though the Packages contained an apparently correct reference and I was using the namespace in my file.

I tried to reset the nuget cache using Package Manager Settings | Clear All NuGet Cache(s). This also failed so I followed the instructions here https://docs.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders#:~:text=Clearing%20local%20folders,-If%20you%20encounter&text=Any%20packages%20used%20by%20projects,All%20NuGet%20Cache(s)..

The problem is that the instructions don't tell you how to restore all this stuff after clearing it. The build of my solution is now completely shafted, to the point where it can't even find NETStandard2.0.

Does anyone know how to fix this?

You should just be able you right-click on the solution node in the solution explorer in Visual Studio and select "Restore nuget packages".....but give it a few minutes as it takes a while to restore your nuget cache, you should see activity in the VS status bar, also check your package source is set to nuget.org in the package manager.

• GBMember ✭✭✭

@NMackay Thanks for the reply. Unfortunately, it just says there is nothing to restore. The package source is set to nuget.org.

I tried a repair of VS but that didn't work either.

• GBMember ✭✭✭

@NMackay Jeepers! Even a complete wipe of Visual Studio and a reinstall hasn't fixed it.

I've pasted the first error below. If anyone has the slightest idea how to fix this, I would be forever in your debt.

3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2081,5): warning MSB3106: Assembly strong name "C:\Users\patri.nuget\packages\system.numerics.vectors\4.5.0\ref\netstandard2.0\System.Numerics.Vectors.dll" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash().

Not sure what's going on, it's been so long since I migrated a project to use packages references, it was so horrible before they made that change.

Your platform specific csproj files should have package references

    <PackageReference Include="Xamarin.Forms">
<Version>4.6.0.800</Version>
</PackageReference>


And your .NETSTandard app project should have the appropriate entries

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<ExternalConsole>false</ExternalConsole>
<DefineConstants>TRACE;DEBUG;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType></DebugType>
<Optimize>true</Optimize>
<Commandlineparameters></Commandlineparameters>
<DefineConstants>TRACE;RELEASE;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Plugin.Permissions" Version="6.0.1" />
<PackageReference Include="Prism.DryIoc.Forms" Version="7.2.0.1422" />
<PackageReference Include="Prism.Plugin.Popups" Version="7.2.0.1046" />
<PackageReference Include="Rg.Plugins.Popup" Version="2.0.0.2" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
<PackageReference Include="Xam.Plugin.Media" Version="5.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Xamarin.Essentials.Interfaces" Version="1.5.3.2" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="3.2.2" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="3.2.2" />
</ItemGroup>


Etc.

Maybe roll back and start again, there's plenty of guides out there for porting.

• Member ✭✭

For me I right clicked in VS2019 and moved from package.config to package reference, after that I could update Xamarin Essentials however when I build on iOS I get "The type or namespace name 'Essentials' does not exist in the namespace 'Xamarin' "

• GBMember ✭✭✭

@batilak

I haven't migrated a project recently because I have no more to migrate but I have had no problems with the new system in about the last six months. It is a big improvement.

I do still have nightmares about the seemingly irreversible problem I had that prompted all of this post. The error message I got should have read: "Your last mouse-click has broken your whole build environment, nuget package manager and Windows 10 installation. Please wipe your drive and start again."