Error when building Xamarin project - c#

I'm receiving this error everytime i try to build my xamarin project
Can not resolve reference: `Parse`, referenced by `Project`. Please
add a NuGet package or assembly reference for `Parse`, or remove the reference
to `Project`. Project.Android
So far I've tried:
Deleting all the folders in packages > restarting VS2017
Running VS2017 as Admin
None of those worked, anyone has any idea how to fix this?
Thanks in advance.

I changed the Android version to 10.0 from 11.0, uninstalled and reinstalled Parse again and it worked.
Edit
Stopped working again. Upgraded to the 2.0.0 version as per this link - https://github.com/parse-community/Parse-SDK-dotNET/issues/303
Edit
Stopped working again. Went back to the 1.7 version but this time didn't use the Nuget package. Extracted Android and IOS dlls and added them manually as references. Working now.
Edit
Download Parse-1.7.0.zip
from https://github.com/parse-community/Parse-SDK-dotNET/releases/tag/1.7.0
Extract the contents.
Add Parse.Android.dll to the Android project.
Add Parse.iOS.dll to iOS project.
Add Parse.dll to Assemblies in the main project.

Related

Visual Studio versioning is different that what was installed

I am working on a project in C# and multiple times I have installed nuget packages and put the latest version but then I get errors that it can't find a completely different version number.
Here is one nuget package that I had this problem with:
Version I installed
and this is the version that is added to my project:
Version in project
I am not sure why this is happening but if anyone has had this issue how have you fixed it? The way I've looked up how to fix this was not bringing me any results. Thank you
Edit: thought id also show the error my service gets from it when starting
error message

Azure Function App failing to load IOptionsFormatter

I have a C# Azure Function App that I'm trying to run locally. It previously had worked fine some months ago but is now failing with the following:
A host error has occurred
Microsoft.Azure.WebJobs.Extensions.Storage: Could not load type 'Microsoft.Azure.WebJobs.Hosting.IOptionsFormatter' from assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
At some point I had updated the Azure Functions and Web Jobs Tools to the latest version (15.10.20460.0).
On startup, it was having problems indexing the functions so I updated the Microsoft.NET.Sdk.Functions nuget package reference to the latest version (1.0.24) which is now giving me the above error.
I also added a nuget package reference to Microsoft.Azure.WebJobs.Extensions.Storage 3.0.3 to resolve the missing TableAttribute errors that appeared as well.
I've checked the assemblies in the bin folder which have the following versions:
Microsoft.Azure.WebJobs.Extensions.Storage.dll - v3.0.3.0
Microsoft.Azure.WebJobs.Host.dll - v3.0.4.0
For Visual Studio for Mac 2019 users I found the following to help me. If you add an azure functions project to your solution there should be a message that there are updated templates available. Click that, let them update and then cancel adding a new project.
This appears to update the tooling as well. My error went away. Not sure why a brand new VS for Mac 2019 install didn't have updated tools.
Changing the Nuget Package Reference for Microsoft.Azure.WebJobs.Extensions.Storage from the latest version - 3.0.3 to 3.0.2 resolves the issue.
Running the function project now launches successfully with no errors displayed.
I'm using Visual Studio 2019 (16.2.0) with most of my Microsoft.Azure.WebJobs.Extensions being version 3.0.6.
After trying out all suggestions above without success, I recognized that I was missing the "Connection" attribute in my ServiceBusTrigger.
Adding the connection attribute resolved the issue immediately.

Could not load file or assembly 'System.Security.Principal.Windows'

Solution has compiled successfully, but after I added an existing class file to the project, this error appeared:
The specified task executable "csc.exe" could not be run. Could not
load file or assembly 'System.Security.Principal.Windows,
Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
one of its dependencies. The system cannot find the file
specified. MvcApplicationRegister
I installed System.Security.Principal.Windows package By NuGet, but error still appears.
None of the previous answers worked for me.
The problem was that I didn't have the .NET Compiler Platform SDK installed.
To solve, open Visual Studio Installer, choose "Modify", and under the "Invididual Component" tab, check the .NET Compiler Platform SDK, and confirm your changes by clicking "Modify".
After I installed it and reopened Visual Studio, the problem is gone.
I had the same issue after I upgraded Microsoft.Net.Compiler from 2.8.2 to 2.9.0.
After I downgraded to 2.8.2 projects compiled without any errors.
Had this same issue and resolved it.
In a 3 project solution MVC controller (Web,Business,Data)
Caused by the Microsoft.Net.Compiler 2.9.0 being installed on the Web project but not the other projects.
To resolve:
Right click the solution.
Manage NuGet Packages.
Installed > Search for the compiler
Ensure it is the same version and it is installed on all projects in your solution
Once installed my solution built successfully
If you are using Microsoft.CodeDom.Providers.DotNetCompilerPlatform you can upgrade to 2.x and then remove Microsoft.Net.Compilers as it's no longer needed. That solved it for me, however I couldn't even build the solution in the first place. It was still complaining about System.Security.Principal.Windows though, I could also solve it by referencing System.Security as an assembly. It's not recommended though.
Close down all instances of Visual Studio. Then reopen the solution and rebuild.
I uninstalled both Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers and everything now works.
In my case I could go from Microsoft.Net.Compilers 2.4.0 to Microsoft.Net.Compilers 2.10.0. No need to use Microsoft.Net.Compilers 2.8.2.
I do not like removing packages without first understanding what I'm removing. I faced the same problem with my solution.
I discovered that 1 of the many projects was using the Microsoft.Net.Compilers NuGet package - let's call it Project ABC. A Unit Test project was referencing that Project ABC, but not the Microsoft.Net.Compilers NuGet package.
I simply referenced the Microsoft.Net.Compilers NuGet package from my Unit Test project, and the problem has now gone away.
Updating Microsoft.CodeDom.Providers.DotNetCompilerPlatform and deleting Microsoft.Net.Compilers worked for me.
I had the same issue here using 'System.Security.Principal.Windows' version 4.7.0. For some reason when I installed the nuget package it was referecing the dll from the folder: C:\Users\{your-user}\.nuget\packages\system.security.principal.windows\4.7.0\ref\netstandard2.0\System.Security.Principal.Windows.dll then I changed to reference the dll from the folder C:\Users\{your-user}\.nuget\packages\system.security.principal.windows\4.7.0\lib\netstandard2.0\System.Security.Principal.Windows.dll and everything worked just fine! So I copied the dll from the lib folder to my project and made a direct reference.

Xamarin Evolve - Errors on compilation

I just downloaded the XamarinEvolve project from GitHub and when trying to compile it on Microsoft Visual Studio Professional 2015 I got lot of errors as you can see on the following image:
Lot of these errors are related with the Google Cloud Messaging (GCM).
As you can see on the image above I downloaded the DLL from:
https://components.xamarin.com/view/googleplayservices-gcm
and added it to the project. But I think I'm still doing something wrong.
Any idea on how to fix this?
I have installed the project and build it on my machine. I have two issues with the project.
The first one is that need to have Android API 24. So, install it from Android SDK Manager.
The second one regarding the GCM. Please delete the GCM from your project using Package Manager Console using Uninstall-Package Xamarin.GooglePlayServices.Gcm. Then try reinstalling it using Install-Package Xamarin.GooglePlayServices.Gcm -Version 29.0.0.2
Clean, And Build.

Xamarin Forms Deployment Fails After Update

After updating Xamarin from visual studio , Xamarin.Forms application gives this exception when running
System.MissingMethodException: Method Android.Support.V4.Widget.DrawerLayout.AddDrawerListener not found
I did try to update the Nuget Packages, re-install Xamarin for visual studio, re-install android sdk, no thing worked .
How can I solve it ?
Maybe you have updated packages Android.Support.xxxx. Try it:
Uninstall the Xamarin Forms packages and all the android support packackage.
Reinstall just the latest Xamarin Forms Nuget package. Letting it grab the Android support packages. Ignore any Android.Support.xxxx updates.
So I just reproduced your issue and I am sorry that you and other ran into this. It looks like there was an issue in the templates and I am working with the team to quickly resolve this.
To fix:
Simply right click on the android project and select "Manage Nuget Packages"
Go to Updates
Find Xamarin.Android.Support.v7.AppCompat
Select version 23.3.0 from the version picker and hit Install
You additionally will need to install the RecyclerView 23.3.0 NuGet Package. * Go to Browse and search for: Xamarin.Android.Support.v7.RecyclerView and make sure to pick 23.3.0 to install for the correct version
Now do a full clean/rebuild and it should work
This should install the correct versions of everything you need for Android
Optionally, you can select just Xamarin.Forms and update to the latest version on ALL projects and it should update all references that it needs.
Please upgrage your xamarin.forms NuGet package to lastest version.
Xamarin Forms Deployment Fails After Update using Visualstudio
System.MissingMethodException: Method Android.Support.V4.Widget.DrawerLayout.AddDrawerListener not found. below image
am using Visual studio 2015 in android uninstall all packages
next install xamarin.forms package only.
then it is working fine..
Note:upgrade a new versions in Pcl,android (Xamarin.Forms v2.3.1.114)versions and pcl and andriod versions are most be Same

Categories