UIKit.UIBarButtonItem fails build with Xamarin.Forms 4.0 - xamarin

I updated my xamarin forms to latest xamarin form 4.0. Now after updating it I am getting following error:
Can't resolve the reference 'UIKit.UIBarButtonItem Xamarin.Forms.Platform.iOS.ToolbarItemExtensions::ToUIBarButtonItem(Xamarin.Forms.ToolbarItem,System.Boolean)', referenced from the method 'UIKit.UIBarButtonItem Naxam.Controls.Platform.iOS.TopTabbedRenderer/<>c::b__57_0(Xamarin.Forms.ToolbarItem)' in 'Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
How can I fix it?

Related

Unable to publish Xamarin App to iPhone. It will not compile

Xamarin Forms v4.3.0.947036 VS 2019
I made a dummy App (Master/Detail Xamarin template) and published it to an iPhone connected to a MAC on my network. Runs fine.
I have another App (my main App) that functions fine on both Android/iOS emulators and Android Phone.
However, when I try and publish it to the iPhone (iOS 12.4) (same setup as with the Dummy App) I get the following error when I compile:
Can't resolve the reference 'System.Void Xamarin.Forms.Log::Warning(System.String,System.String)', referenced from the method 'System.Void Xamarin.Forms.Pages.BaseDataSource/<Initialize>d__22::MoveNext()' in 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
This is the full error in the output window:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): error MT2101: Can't resolve the reference 'System.Void Xamarin.Forms.Log::Warning(System.String,System.String)', referenced from the method 'System.Void Xamarin.Forms.Pages.BaseDataSource/<Initialize>d__22::MoveNext()' in 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
Does anyone have any ideas on what could possibly be causing the error?
The problem was with the pre-release 'themes'. I removed all references to them from any Projects and the error disappeared.
Reference: https://forums.xamarin.com/discussion/140586

Xamarin Prism.Unity.Forms 7.0.0.396 give error on update from version 6.3

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Microsoft.Practices.Unity.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters)
Can you please suggest for solutions
Your error message tells you everything you need to know: Microsoft.Practices.Unity, Version=4.0.0.0. You have a reference to v4.0 of Unity. Prism 7 references v5.0. You need to check your dependencies as somewhere you have a reference to the old package.
Also note that due to some changes that were made in the way that Unity ships, Prism has also made a change from referencing the Unity package to the Unity.Container package as of Prism 7.1.

Xamarin Forms - Error MT2101: Can't resolve the reference 'UIKit.UIEdgeInsets UIKit.UIView::get_SafeAreaInsets()'

I am working on a Xamarin.Forms project and i am getting the following error after i updated my Xamarin.Forms version to 2.5.0.122203.
/Users/UserName/Official/Projects/ProjectFolder/ProjectName/iOS/MTOUCH: Error MT2101: Can't resolve the reference 'UIKit.UIEdgeInsets UIKit.UIView::get_SafeAreaInsets()', referenced from the method 'System.Void Xamarin.Forms.Platform.iOS.PageRenderer::ViewSafeAreaInsetsDidChange()' in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. (MT2101) (ProjectName.iOS)
How can i resolve this? I have XCode 9.2., Xamarin Studio 6.3 installed in my machine.
I tried to change the link mode to 'Don't Link' (although its not preferable) but it gives different problems.
in PCL project you can't use UIKit library, you can use this library only in IOS Project

Project using PCL 'TPL Dataflow' won't compile when targetting .NET 4.5.2

I'm using Windows 7 Pro x64 SP1 and Visual Studio 2012 Update 4. I can't get my VB.NET WPF project to compile when using the TPL Dataflow package and .NET 4.5.2. I've created a base project with nothing except this code and compile only for x64:
Imports System.Threading.Tasks.Dataflow
Class MainWindow
Dim test As New System.Threading.Tasks.Dataflow.BufferBlock(Of String)
End Class
I've tried adding the facade reference to System.Runtime.dll and System.Diagnostics.Tracing.dll with no effect. It compiles fine if I change to .NET 4.5. I must have a reference to 4.5.2 because of other features that will be in the project that require it.
Specific errors:
Warning 1 The primary reference "System.Threading.Tasks.Dataflow, Version=4.5.23.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.2". To resolve this problem, either remove the reference "System.Threading.Tasks.Dataflow, Version=4.5.23.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". TPLDataflow4.5.2Demo
Warning 2 The primary reference "System.Threading.Tasks.Dataflow, Version=4.5.23.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Diagnostics.Tracing, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.2". To resolve this problem, either remove the reference "System.Threading.Tasks.Dataflow, Version=4.5.23.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Diagnostics.Tracing, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". TPLDataflow4.5.2Demo
Warning 3 Namespace or type specified in the Imports 'System.Threading.Tasks.Dataflow' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. F:\Projects\TPLDataflow4.5.2Demo\TPLDataflow4.5.2Demo\MainWindow.xaml.vb 1 9 TPLDataflow4.5.2Demo
Error 4 Type 'System.Threading.Tasks.Dataflow.BufferBlock' is not defined. F:\Projects\TPLDataflow4.5.2Demo\TPLDataflow4.5.2Demo\MainWindow.xaml.vb 4 21 TPLDataflow4.5.2Demo
Solution:
It turns out the Microsoft .NET Framework 4.5.2 Developer Pack I was using had a bug that wouldn't let PCLs compile correctly.
I downloaded and installed the updated version of the Microsoft .NET Framework 4.5.2 Developer Pack from http://support.microsoft.com/kb/2901951 and my application was able to compile without errors.
There is a ticket on connect specifying the use of .NET 4.5.2 with PCL libraries causing builds to fail.
This was fixed in the Microsoft .NET Framework 4.5.2 Developer Pack
When you recompile a Microsoft .NET Framework 4.5.1 application that uses .NET portable libraries to target the Microsoft .NET Framework 4.5.2, you receive the following error message during compilation:
The type '{type}' is defined in an assembly that is not referenced. You must add a reference to assembly '{assembly}'

Upgrading VS2010 to 2013 introduced compile error with SendGrid

I installed the ultimate trial of Visual Studio 2013 yesterday to see if it had any negative impact on our current 2010 based projects. When trying to compile a project that previously had no problems and still compiles on my colleagues computers I encountered this error:
The type or namespace name 'SendGridMail' could not be found (are you missing a using directive or an assembly reference?)
The error is the same when run from Visual Studio 2010 or 2013
Looking at similar questions on here suggests that this happens when using the .net 4 Client Profile instead of standard .net 4, but this project has always used standard .net 4.
Another question was using the latest version of sendgrid (4.x) with .net 4 which I understand doesn't work, but we are using an older version (1.2.1).
Personally I have tried:
Removing and Readding the reference (originally it was referenced inside the project, I also tried referencing it externally)
Running Visual Studio with no addons
Recreating the project in another solution
The only luck I have had so far has been to use nuget to install the sendgrid package instead but this seems to add a lot of additional files and at the moment I'm more interested in why a previously working build has stopped working with no changes to the project other than installing another version of Visual Studio.
Edit:
This is the output when trying to build with the SendGridMail dll (succeeds since it's not used in code):
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Threading.Tasks, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Threading.Tasks, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Runtime, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
I was able to resolve this by removing the .NET 4.5 SDK (but not the framework itself). I assume it was looking at the latest framework for the dlls despite the project being set to .NET 4

Resources