Nuget Reference error while installing googleanalyticssdk in UWP app - google-analytics

I have ported my windows 8.1 app to UWP app and now when I try to install googleanalyticssdk into my app in visual studio 15 from nuget package manager I get the following error
Error:
Failed to add reference to GoogleAnalytics.Core
I have tried many solutions such as uninstalling other versions etc etc but none of them seem to work for me. What might be the reasons please suggest.

Please follow these steps to install packages:
Right click the solution
Choose "Manage Nuget Packages..."
Search "GoogleAnalyticsSDK"
Install version 1.3.0
If you still see such exception, please show us the Output from Package Manager, for example:
As karann mentioned, please also try the result of a blank UWP app, if it works, we need to focus on your existing project.

Related

Nuget Package Clash on Different Dependency Version

I'm using Xamarin.Forms.Maps and Microsoft.AppCenter.Push in my PCL project. Lately I tried to update my Push to latest version, but it's clashing with the Maps because different version of Xamarin.GooglePlayServices.Base is expected.
Severity Code Description Project File Line Suppression State Error
NU1107 Version conflict detected for Xamarin.GooglePlayServices.Base.
Install/reference Xamarin.GooglePlayServices.Base 71.1610.0 directly
to project XXX.Android to resolve this issue.
XXX.Android -> Microsoft.AppCenter.Push 2.5.0 ->
Xamarin.Firebase.Messaging 71.1740.0 -> Xamarin.Firebase.Iid 71.1710.0
-> Xamarin.Firebase.Iid.Interop 71.1601.0 -> Xamarin.GooglePlayServices.Base (>= 71.1610.0)
XXX.Android -> Xamarin.Forms.Maps 4.3.0.947036 ->
Xamarin.GooglePlayServices.Maps 60.1142.1 ->
Xamarin.GooglePlayServices.Base (= 60.1142.1).
Push is expecting version 71 while Maps is expecting version 60. May I know how to resolve this and I'm curious why cannot the Maps use the later version? Is it not backward compatible?
Thank you.
Yes, I have reproduce this problem as you said.
Accoriding to the error log, we know that the problem is that though the Xamarin.Forms.Maps Nuget have been updated to a newer version, but the package (Xamarin.GooglePlayServices.Base) in this nuget hasn't been updated synchronously to the later version( 71.1610.0). It should be an issue of this Nuget. And we can report it as a bug here: https://github.com/xamarin/Xamarin.Forms/issues
For now, in order to keep the code working properly,what we can do is keep the two Nuget versions in sync.
Just install nuget Microsoft.AppCenter.Push 2.1.1 and nuget Xamarin.Forms.Maps 4.3.0.947036.
EDITED
If you read the comments, there is one saying that you can install dependencies manually.
In this case, by visiting the NuGet repo for Xamarin.Forms.Maps you can see in the dependencies list that it requires Xamarin.GooglePlayServices.Maps.
Just make sure you already have dependencies installed, or simply add them to your Android solution (I added also Xamarin.Android.Support.v7.AppCompat).
By following these steps, I'm able to run both Xamarin.Forms.Maps (v4.4.0.991477) and Microsoft.AppCenter.Push (v2.6.4).
There is an issue on the GitHub relate repo and seems to be fixed.
Refer to following link please
NuGet version conflict between Xamarin.Froms.Maps and Microsoft.AppCenter.Push
You can check the whole evolution of the issue.

Package restore failed for xamarinforms project in visual studio 2017

error message is : Package restore failed. Rolling back package changes for 'XFDemo.Android'".
steps to generate this error :
1. create new xamarinforms project.
2. right click on solution => select "Manage NuGet Packages for solution".
3. from "NuGet Solution" windows I choose update tab.
4. select all items then click on update.
5. aftr I tried to update I got the error message "Package restore failed. Rolling back package changes for 'XFDemo.Android'"
how I can solve this issue ?
I tried to clear NuGet Packages cache but the clear is faild.
The solution for this issue is as mentioned above
I just install Oreo 8.1 SDK/Tools via Android SDK Manager and in properties of your app, select target framework to last Oreo version. –
and its work :)

New xamarin.forms project creation gives NU11002 Unable to find package Xamarin.Forms with version (>= 250121934.0.0)

Recently i updated my visual studio 2017 enterprise to 15.5.0. I am trying to create xamarin forms project as Blank App, platfom Android + ios, UI Technology Xamarin.Forms, code sharing strategy .net standart. When i try to build the default created project i got the following error;
Severity Code Description Project File Line Suppression State
Error NU1102 Unable to find package Xamarin.Forms with version (>=
250121934.0.0)
- Found 163 version(s) in nuget.org [ Nearest version: 2.5.0.121934 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages
I can not also remove and install xamarin.forms nuget. Any ideas?
Install xamarin.forms on all projects, in my case I was missing in the iOS project, it was enough to install the xamarin.forms nuget and everything worked normally. I hope it helps.
i finally found the solution. I opened android sdk manager and install Android 7.1 Nougat SDK (previously android 6.0 was installed). Then i right clicked solution and opened nuget manager. I selected Xamarin.forms package and choose the latest version of package and click install. I refreshed the package in all projects. Now everything works well.

The term 'Add-migration' is not recognized - VS2017 and EntityFrameworkCore

I am posting this question just in case the solution I found would help someone else out. While working in Visual Studio 2017 rc4 each time I tried to run the Add-Migration command in the Package Manager console I get the following error:
The term 'Add-migration' is not recognized...
The solution that worked for me after trying a whole raft of other solutions posted, was to:
right click on my project
select Manage Nuget Packages
select the browse tab
thick Include prerelease check box
install the Microsoft.EntityFrameworkCore.Tools
N.b that aspnetcore project in visual studio 2017 do not seem to have the project.json file.
You just need to initialize the powershell module. I believe this is a bug, but it's pretty easy to work around. All you need to do is find the init.ps1 file and dot source it.
Just type this into the package manager console:
C:\Users\YourUserAccount\.nuget\packages\Microsoft.EntityFrameworkCore.Tools\1.1.0-preview4-final\tools\init.ps1
Now the version might be different for you, depending on which one you have installed. Make sure you dot source the same version that is in your project.
Hi There
This is almost an normal problem in Microsoft, and they pointing out the same solution:
Microsoft Docs - Getting Started with EF Core on ASP.NET Core with a New database
For me above dosn't solve my problem, but this line first does:
PM> Install-Package Microsoft.EntityFrameworkCore.Tools
PM> add-migration InitialCreate
/Cheers, Jan
Make sure that the Microsoft.EntityFrameworkCore.Tools package is installed. If it's not, then add it from NuGet or simply type the following in the Package Manager Console:
Install-Package Microsoft.EntityFrameworkCore.Tools
Installing the above package worked for me.
If your are using VS 2019 and Dot.net core version 3.1
Just install the : Microsoft.EntityFrameworkCore.Tools from Manage NuGet Packages
this solved my problem.
I have had the same problem with a project created with VS2017 version 15.9.4 and .Net Core 2.1.
I have fixed it by adding Microsoft.EntityFrameworkCore.Tools to dependences of my project.
On project select Manage Nuget Packages
Browse and Search Microsoft.EntityFrameworkCore.Tools
Install it on your project
Then you can open Package Manager Console and use commands :
Add-Migration
Drop-Database
Get-DbContext
Scaffold-DbContext
Script-Migrations
Update-Database
Regards
dcube
Download the latest .net Core 2.0 from the link below and it will fix your issue:
https://www.microsoft.com/net/core#windowscmd
I reinstalled package Microsoft.EntityFrameworkCore.Tools and issue got fixed for me.
It works for me.
Close all VIsual Studio instances.
Open VS.
Open Package Manager console, let it be initialized.
Now open the project and try Add-Migration.
For me, I had to copy the folder microsoft.entityframeworkcore.tools from
C:\Program Files\dotnet\sdk\NuGetFallbackFolder
To
C:\Users\<user>\.nuget\packages
You have to add this to your CSPROJ file. This will most likely be fixed when the Core 2.0 is released. This stems from an issue where you can not install this package Microsoft.EntityFrameworkCore.Tools.DotNet using the NUGET tools due to version requirements.
Then using CMD/PowerTools in the project directory you can issue the following commands:
dotnet ef migrations add InitialCreate
dotnet ef database update
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.1" />
</ItemGroup>
I had the issue with VS2019 Enterprise on a .NET MVC 5 project with EF6.3.0. I was pulling my hair out and crushed for time. I was trying everything. In desperation, here's what I did that finally worked, FWIW.
Open VS2019
Let it completely finish all background processes on load (lower
left-hand corner animated icon)
Close Package Manager Console
Right-click Project, select "Manage NuGet Packages"
Check "Include Pre-Release"
Choose "Browse" Tab Update EntityFramework to V6.4.0-preview2-19525-03
Close VS2019 Open VS2019 Select from Menu:
Tools > Nuget Package Manager > Package Manager Console which opens
the PM console
At THIS point, FINALLY, add-migration "MyReferencePoint" worked!
Hope this helps someone.
we get the same error when "add-migration", i try one solution which is update Package Manager by using follow step
In Visual Studio, from the "Tools" menu choose the "Extensions and Updates" option.
From the dialog that appears, expand the "Updates" node from the tree at the left side.
Select the "Visual Studio Gallery" option from the tree.
Finally, look for the Package Manager update in the list of updates at the right side of the dialog and click the "Update" button beside it.
it is approx 5 - 10 MB update, after update complete try Get-Help Add-Migration

Package tried to add reference to System.Runtime which was not found in the GAC

ASP.NET 4.5.1 or 4.5.2
Updating Nuget package MicrosoftAspNet.Identity.EntityFramework from version 2.2.1 to version 3.0.0-rc1-final
I get the following error:
Failed to add reference. The package 'Microsoft.AspNet.Identity.EntityFramework' tried to add a framework reference to 'System.Runtime' which was not found in the GAC. This is possibly a bug in the package. Please contact the package
owners for assistance.
I had a similar issue with another package.
I "solved" it adding a manually reference to missed library, updating the package and then removing the reference added manually:
On your project go to References -> Add Reference... and then click on Browse...
On my installation (Windows 10), your file is located on: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll
Add, update and then remove.
I know, it is not a solution, but it will allow you continue working until get a real solution.
I had the same issue, but adding the MySQL package to my project.
The way that i solved was just very closely to the answer given by Sebastián Guerrero.
So i will be adding a manually reference to that missed library (system.runtime) and than installed the MySQL package and it works perfectly.
ATTENTION: I only unnistall the system.runtime package after installing the MySQL.
References -> Add Reference... and then click on Browse...
On my installation (Windows 10), your file is located on:
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll
I had the same issue when running Install-Package Microsoft.Azure.Management.Fluent on .NET framework 4.5.2
Solved the issue with the following steps:
Installed Microsoft.Rest.ClientRuntime latest version from Nuget.
After that, installed latest version of Microsoft.Azure.Management.Fluent from Nuget.
I had this problem when I opened the project after a while.
The problem was it was originally built with Microsoft.Net.Compilers.2.4.0 and I was on 3.3.1.
The project strangely added two required Imports to the .csproj file, one for the 2.4.0 compiler,and a duplicate for the 3.3.1 version. I just needed to:
Right click on the project file
Unload the project
Edit the csproj file
Remove the 2.4.0 references (was also a reference in an Error element)
Close file
Right click on project, reload file.
Rebuild All

Resources