I have a working Xamarin.Forms project that was building fine, when suddenly (after Visual Studio had been closed/reopened, presumably after some update), I started getting the following error:
Failed to resolve assembly: 'MYAPPNAME, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
How do I resolve this error? It doesn't give me a file or location where the problem is, & ProcMon doesn't appear to be helpful either.
Xamarin.Forms scaffolding apparently will sometimes build a circular assembly reference.
The broken reference will be in one of your XAML files and look like this:
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MYAPPNAME;assembly=MYAPPNAME"
... />
The problem is that at some point Xamarin stuffed in the assembly=MYAPPNAME text.
In some cases, your previously built assembly is either gone/not usable, and therefore this assembly reference is trying to resolve itself before the project is ever built - i.e. it will never work.
Simply remove the bolded text above, save your XAML file, rebuild and everything should be fine - if you still get the same error, you may have other circular reference in other XAML files.
Bug with Xamarin/MSFT pending.
Related
I'm getting this error trying to build a Xamarin.iOS project referencing a .NET Standard 2.0 library.
None of the MT2001 issues online seem to have this specific "Error while processing references" reason, so I'm at a loss as to how to diagnose this. I've tweaked and fiddled about as much as any one person can and stay sane, but I'm really in the dark.
Can anyone out there point me in a direction?
Adding -v -v -v -v to "Additional mtouch arguments" in the project iOS Build settings will help diagnose the issue. After that, you can search the build output for MT2001 and view the inner exceptions. Obviously, each project may differ as to what assembly causes the linker to fail. You may need to add, remove or fix your references based on the output.
For example, I was trying to use SignalR from AspNetCore 2.1, which has a dependency on System.Threading.Tasks.Extensions 4.5.1 in my project, which it seems Mono does not yet support. Mono does not provide its own version of the assembly yet, so when mtouch goes to link the assembly, it's unable to do so and throws an exception:
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Removing all references to this assembly (and therefore the whole feauture in my case) allowed the build and linking to succeed.
I've found that I get this when using a Xamarin library that is dependent on System.Reactive 4.1.0. There's a bug in there associated with System.Threading.Tasks.Extensions, and since it is a library I'm writing, I had to roll back to System.Reactive 4.0.0.
For me the error is as follows.
one of the package is mentioned in package.config file but it was not available in packages. So i added the missing package from nuget and the app works fine
My Android Application works fine but when I launch my UWP application it crashes in the OnLaunched of my App.xaml.cs at the line of Xamarin.Forms.Forms.Init(e)
This is the error I'm getting:
System.IO.FileNotFoundException: 'Could not load file or assembly
'clrcompression, Culture=neutral, PublicKeyToken=null'. The system
cannot find the file specified.'
It completely makes my app crash, only thing I can see is my Splashscreen.
In IOS got a similar issue. It also show an error of FileNotFoundexception but it doesn't break and I can go past it. It show the error in my Main.cs at the line of UIApplication.Main(args, null, "AppDelegate");
As discussed in the comments of the original post, and for anyone else that stumbles accross this thread with the same exception, in most instances the cause would appear to be related to Xlabs assemblies either not loading correctly, or having not been removed completely. This appears to have been an issue for at least the last half a year (past example of similar situation can be found Here).
The solution in this instance if you removed the xlab references but still get the error, is to delete the obj/bin/.VS folders from your project folder. Then for a UWP project, rebuild and then deploy. The issue should be resolved.
I've had a look at similar postings but haven't found one that has helped fix this issue.
Just briefly, I have an mvc3 project running on azure. A couple of days ago it lost it's reference to System.Web.MVC for some reason. So I added the reference and changed the Copy Local property to True.
It built and ran on the local emulator ok. I then published it and got the following message when visting the website.
"Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0"
It turns out I only version 3.0.0.1 and not 3.0.0.0 which is stated in my web.congig file. I've tried changing the value in web.config in both the assembly and runtime sections to 3.0.0.1 but this throws another exception in azure.(although didn't change the Public Token)
I've also tried Add Deployable Dependency but this has made no difference and I've tried downloading and adding vers 3.0.0.0 to the project but vs didn't like this dll when publishing.
I've also tried changing the property Specifc Version for the assembly to False but this hasn't worked.
So for some reason I don't have v3.0.0.0 anymore but don't know how to change my project to use v3.0.0.1 I guess.
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line 39:
Line 40:
Line 41:
Line 42:
Line 43:
Source File: E:\sitesroot\0\web.config Line: 41
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Thank's guy's. I actually just commented out the assembly line of code for the mvc assemble and changed the runtime binding code to look for v 3.0.0.1 in web.config and this has done the trick. I'm not sure if that was the best solution but having spent over a day on it time was a big factor.
I was getting a very similar error
My solution had previously been working and nothing had changed apart from some activities using source control
I created a completely new workspace and checked out the entire source code again to the new workspace, and this fixed the issue (just doing a 'get' and a 'Get Specific Version' wasn't enough)
Looks like something had got screwed up in my workspace that prevented the compiler from finding the correct .dll. Possibly related to finding it in the GAC?
I have had this problem on and off randomly for a while and I now know why.
When you update a nuget package and the package has a web.config file as part of the nuget package, it merges the content of web.config file in the nuget package with your config file. The nuget package was a private package that I build and didn't realise this.
The web.config file in the package contained the binging redirects for MVC and this causes my config file to suddenly have duplicate entries. I initially missed it because it does all the binding redirects on one line.
Once you remove any duplicate binding redirects it fixes the problem. This question was big clue to me finding out what causes this.
After upgrading to Xamarin.Forms 1.2.3 I'm getting the following compiler error related to the definition of a custom renderer:
Error CS0012: The type `Xamarin.Forms.Platform.Android.FormsViewGroup' is
defined in an assembly that is not referenced. Consider adding a reference to
assembly `FormsViewGroup, Version=1.2.3.0, Culture=neutral,
PublicKeyToken=null' (CS0012) (XFormsNavigation.Android)
What is wrong and how can I fix it?
Not sure, why you have to add a Xamarin.Forms library manually. But here's what to do:
In packages/Xamarin.Forms.1.2.3.6256-pre4/lib/MonoAndroid10/ (or similar depending on your Xamarin.Forms version) you'll find the library FormsViewGroup.dll. Add it to the references of your Android project and it should compile.
im receiving a very weird error from the IDE while compiling.
C:\Program Files (x86)\MSBuild\Microsoft\Silverlight for
Phone\v4.0\Microsoft.Phone.PreImport.targets(38,9): error : Could not
load file or assembly '0 bytes loaded from System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. An attempt was made to load a program with an incorrect
format.
what really makes this weird is the fact that on another computer the program is compilable.
thanks for your help
edit: just found out that the reason for that error is because of the panorama -view.. i tried to create a new project with a panorama view, still received same error
Do you have the correct references in the project?
Did you modify any of the "stock" references?
You could try repairing the SDK or create a new Panorama-based application and see if it works.