I'm trying to build a simple barcode scanner using Xamarin forms and I'm using ZXing Library (I copied/added the Dlls manually).
when i build the project i get the following errors:
'Resource.Id' does not contain a definition for'contentFrame'
'Resource.Layout' does not contain a definition for 'zxingscanneractivitylayout'
'Resource.Layout' does not contain a definition for 'zxingscannerfragmentlayout'
I did my research before posting this, I know that the error has something to do with the "Resource.Designer.cs" file not being updated but I honestly don't know how to fix this.
I also found this old post with the same problem
[Unknown globals when installing ZXing Scanner
but nothing suggested worked for me.
Any Idea, how can this error be fixed, Thanks for your help.
Edit : I'm using Visual Studio Enterprise 2015 and Xamarin Forms v2.2.0.45
Just update to Zxing.Net.Mobile 2.1.0.1 beta prelease and the errors will disappear.
The problem is widely known
Xamarin bugzilla
Issue on Github repository of Zxing
Related
I am trying to get an App to work with OTA Nordic Dfu, and the only xamarin nuget I can find was the one made by Laerdal on GitHub
When I try to build under iOS I am getting a few error like this one here:
Error MT5211: Native linking failed, undefined Objective-C class: _TtC13iOSDFULibrary11DFUFirmware. The symbol '_OBJC_CLASS_$__TtC13iOSDFULibrary11DFUFirmware' could not be found in any of the libraries or frameworks linked with your application.
A bug is open for this, but so far not a word from the people maintaining it.
I am left wondering if this is actually a local problem and not a problem with the nugget its self. So if any one out here is able to compile this under iOS help would be really appreciated.
Upgraded to Dotnet Core 3.1 from 2.2, EF core kept complaining EF1001: internal ef core api usage by putting an Exclamation Mark in my project.
But no error / warning shown during compilation. I do not know which line of code is causing the trouble.
May I know how can I find out which API / Method that I am not suppose to use?
The warnings from these analyzers can be really confusing. If I understand this correctly, the issue is not what it seems.
The message with the gray warning icon inside the analyzer is normal and indicates what the analyzer is checking. See the Analyzers in Solution Explorer documentation for an explanation.
If you are experiencing yellow icons on the parent node ("Analyzers") try to unload/reload the project, or maybe open Visual Studio in admin mode. See the answer to "Analyzers warnings in ASP.NET Core 2.2 project in VS2019
" for details.
If you don't see a warning in the error list then I advise you to ignore that.
The GitHub issue "Confusing analyzer warnings in solution explorer with no way to see any details" provides additional information on this.
Are you using a database provider (i.e. packages for SQLServer, Postgres, etc)?
It sounds like you are saying there is some warning being given with your dependencies. I know Microsoft announced some breaking changes, mainly for database providers, with EF Core with the 3.0+ updates. Could be as simple as updating the other packages in your project.
Just guessing, I could very well be wrong.
figure it out for me, was getting the same warning,
it was using an entity framework namespace
(using Microsoft.EntityFrameworkCore.Internal;) and not
using System.Linq; which was extremely odd as I didn't add the Ef one at all.
which is why I was so confused and started googling and how i got to this page.
I downloaded VS2019 and proceeded to create a Solution and Project to learn Xamarin. I have tried using different templates (Mobile apps or just iOS) with the same result. Without changing anything in the resultant forms etc., if I build the solution I get the error that Forms does not exist in Xamarin. I have tried to download Xamarin.Forms, but it says it is already installed. I have searched and Googled and while there are similar questions of "name XXX does not exist in namespace YYY", none of those solutions apply in my case. I have tried to re-install VS, done a "repair" to VS. Many sites suggest closing and re-opening the solution (or cleaning), or restoring Nuget - none of that helps. The iOS project contains a reference to Xamarin.ios and I can see Xamarin.Forms under that so it does exist, but the project can't seem to find it. I know people like to see code here, but I haven't done any coding yet.
Solution image
Error image
AppDelegate
The solution was to manually add a folder called Thinktecture in C:/Program Files (x86)/Microsoft SDKs, then do an update of Xamarin.ios. It then gives a host of warnings about "Can't resolve the conflict between....", but it chooses the latest version and the Build works.
I've got a cross platform (iOS and Android) Xamarin solution using .NET Standard 2.0. The solution is being built by Visual Studio 2017 (I've tried both the current and preview versions). The Forms and Android projects build fine. However, the iOS fails to build, with the following error:
1>CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\Users\newuser.nuget\packages\system.reflection.emit\4.3.0\ref\netstandard1.1\System.Reflection.Emit.dll' and 'C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\System.Reflection.Emit.dll'. Remove one of the duplicate references.
I've tried many work arounds as described here:
oren.codes
www.hanselman.com
github.com/NuGet
Unfortunately none of these suggestions work. I have also tried to add the System.Reflection.Emit nuget package directly to the Forms and/or to the iOS projects directly. This doesn't work either. Note that originally, the The System.Reflection.Emit package wasn't referenced directly by anything in the solution. It is being pulled in by the following nuget packages which are being explicitly referenced:
Acr.DeviceInfo (5.0.5)
akavache (6.0.0-alpha0038)
AutoMapper (6.2.2)
Microsoft.Identity.Client (1.1.1-preview0040)
Newtonsoft.Json (10.0.3)
Finally, I have tried the update-package -reinstall command in the package console to reinstall all packages for the iOS project. This doesn't work either.
-- update
Just to make this clear, neither the Xamarin Forms or the Xamarin iOS project directly reference System.Reflection.Emit. That package is being pulled in as a dependency of other nuget packages, just from packages that are installed into the Xamarin Forms project. I have confirmed all of the dependencies that are referenced by Nuget, are using the same version. See these screenshots:
It seems to me that the problem (as the error says) is that there is an old version of System.Reflection.Emit that was installed by Visual Studio. However, I can't find a way of ignoring it and using the version of System.Reflection.Emit instead. As I've said above, I have tried to use a project.json file in the Xamarin.iOS project, and manually ignoring, but this doesn't work.
Does anyone else have any ideas?
As an aside, I notice that this bug is still open for Xamarin.
Xamarin Bugs
Managed to get this resolved thanks to an answer by #DirkWilhem on Xamarin Forums site.
Basically, add this to your Xamarin iOS project's .csproj file, with the other PackageReference nodes:
<PackageReference Include="System.Reflection.Emit">
<Version>4.3.0</Version>
<ExcludeAssets>all</ExcludeAssets>
</PackageReference>
Of course you need to make sure the nuget package has been added to the iOS package first.
Xamarin Forums discussion
After spending hours trying to resolve this myself I may have found a solution. Although it does feel wrong, it has got me past the issue.
Moving/Deleting the Xamarin.iOS version of System.Reflection.Emit.dll has solved the build problem for me and enabled me to deploy and run my app on a device. I don’t know what side effects it might have so will need more testing but I thought I’d share what’s worked for me so you can test it as well.
I was running on macOS Visual Studio 2017 but switched over to Windows to try and fix and first fixed on there then tried same approach on macOS and it worked as well.
On windows, go into the following directory and move the System.Reflection.Emit.dll somewhere else (you could just straight up delete it but I wanted to keep a copy I case this has some undesired effects down the track):
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades
On mac the following directory has it:
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades
Like I say, it feels wrong but for now it’s got me past an issue that’s had me blocked for a couple of days so willing to just move on and hope there’s no side effects. I’d be interested to know your experience with it and if you come across anything else for the future too.
I’ll post this same comment on the Xamarin forums post (https://forums.xamarin.com/discussion/120814/xamarin-ios-project-cs1703-multiple-assemblies-with-equivalent-identity-have-been-imported) as well for future reference.
I had the same issue around a custom Nuget packages that we created and consumed in a separate project. We got around this issue by removing the automatic Nuget building checkbox in the "options" for the project. This does add the extra step of "Create Nuget Package" but one we pushed it to our Nuget repo and consumed it in our project, the errors vanished.
The problem showed up when we updated the sub-projects from PCLs to .netstandards (2.0).
I have downloaded the Xamarin.Forms solution from GitHub and I am trying to build the solution. Visual Studio does not build, generating more than 70 errors, as simple as the one below:
"The type or namespace name 'IOnClickListener' could not be found (are
you missing a using directive or an assembly reference?"in
Xamarin.Forms.Platform.Android\AppCompat\ButtonRenderer.cs
When I investigate the code, I see that there is really no reference to Android.Views.View in the using statements, so it seems fair.
Am I making a mistake somewhere?
It's not easy to get to the answer without digging into the logs but here are some steps that have helped me in the past.
Android Specific Steps:
Check the logs for any problems that stand out, look at the top most error first and work your way down. Output window -> Show output from Xamarin Diagnostic
If you find unzipping problems you might have to visit the Xamarin folders to delete the zip causing problems and Xamarin will download a new one.
C:\Users{USER}\AppData\Local\Xamarin
If you get loads of Xaml and Resource errors you might have to delete the contents of the file.
Resources\Resource.Designer.cs
After deleting the content(not the file), clean the solution, rebuild the project.
If you still have problems try to either downgrade Xamarin.Forms or upgrade it.
Change Api level to a higher one on the project properties.
Hope one of these helps.