I'm trying to run PRISM (MEF) example project, but get this error:
Managed Debugging Assistant 'BindingFailure' has detected a problem in
'Prism4MefDemo.vshost.exe'.
Additional information: The assembly with display name
'Microsoft.Windows.Shell' failed to load in the 'Load' binding context
of the AppDomain with ID 1. The cause of the failure was:
System.IO.FileLoadException: Could not load file or assembly
'Microsoft.Windows.Shell, Version=3.5.41019.1, 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)
I've tried to remove and manualy add reference to Microsoft.Windows.Shell but still nothing.
The version of this DLL is 3.0.1.0, and not 3.5.41019.1 as in the Exception.
This is the line with the Excecption:
protected override DependencyObject CreateShell()
{
return this.Container.GetExportedValue<ShellWindow>();
}
How can I fix it?
Thanks.
Finally I solved this issue by installing Multilingual App Toolkit from here and Add Reference to "Microsoft.Windows.Shell.dll" from the location "C:\Program Files (x86)\Multilingual App Toolkit" or copy the dll to your private assembly folder and refer it.
When you install Microsoft.Windows.Shell.dll from Nuget, it was installing v3.0.1, But the actual expected version was v3.5.41019.1. you ll get this new version from the above path.
Thanks
So after trying everything, I looked for others files in my computer (Microsoft.Windows.Shell.dll) and found newer version, as expected by the Exception (3.5.41019.1) in MicrosoftRibbon for WPF\V3.5 folder.
It is strang,because the latest version of the NuGet package is 3.0.1.
Thanks anyway.
Adding Microsoft.Windows.Shell.dll v3.5.41019.1 to your project references, would solve the problem.
We had this problem when using the Ribbon control.
The solution was remove the ribbon: prefix from the very start of the XAML and use the default ribbon control, not the one that utilizes a namespace.
Related
Visual studio couldn't load file or assembly ,metroframework, Version=1.4.0.0 , Culture=neutral,publickeytoken='5f91a84759b584a' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT:0X80131040)
This error occurs when i run my application every time
I have managed to solve this problem
I just downloaded the required assembly from nuget
In my case i needed metroframework 1.4.0.0
The version is very important here
And every thing worked fine
Thqnk you for your time
I hope this post will help you with your PROBLEM
Yusuf naeem
I've added Microsoft.Bcl.Build/Microsoft.Bcl and Microsoft.Bcl.Async to some projects in my solution where I want to use async/await.
Everything works fine on my machine with .Net4.5 installed. However, when I start the application on a machine with only .Net4 installed, at some point, the application crashes with the following Exception:
Could not load file or assembly 'System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Looking at the StackTrace, the exception seems to be generated in a third party library that we reference.
When I analyze the Microsoft.Threading.Tasks.dll provided by Microsoft.Bcl.Async, I see that it does reference System.Threading.Tasks Version 1.5.11.0, but version 2.6.10.0 is included in Microsoft.Bcl.
Am I doing something wrong?
I found the solution! It was actually very simple. I just had to copy and paste the binding redirects that nuget adds in the app.config files into the *.exe.config file. Then it just magically works. Easy fix.
What I'm trying to do
I'm trying to create a library (Arduino.dll) to interact with my Bluetooth device from a laptop (Windows 10). This library is intended to be used by a desktop application.
To achieve that, I had to reference both Windows.winmd and System.Runtime.WindowsRuntime.
What's working
I did write the library and tested it on a console application which was on another project in the same solution. To make it work, I had to reference the project and Windows.winmd in the test project. Note that this test project is used to test all of my libraries, so it is heavily manipulated and I tinkered with the settings a lot for years.
What's not working
I finished to write my dll, and wanted to use it in my desktop application. Therefore, I referenced both Arduino.dll and Windows.winmd as in my test project, expecting to work the same way. Sadly, on running the application, I got a "dll not found" when instantiating a class for Arduino.dll :
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in LuxAFX4.exe
Additional information: Could not load file or assembly 'System.Runtime.WindowsRuntime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
Strange, but well, I tried to reference the (same) System.Runtime.WindowsRuntime as in Arduino.dll but no luck, I now got an even weirder error :
An unhandled exception of type 'System.BadImageFormatException' occurred in LuxAFX4.exe
Additional information: Could not load file or assembly 'System.Runtime.WindowsRuntime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
During my search for a solution, I understood that I shouldn't try to load this "reference library" and if it is not found, it must be because it is not installed on the system. But then, why would it work in my test project?
Another thing I may have understand, is that if my library doesn't expose members of referenced 'sub'-libraries, they won't be needed when referencing my library. Should I try to 'hide' all references? If so, is there a way to catch all exposed members? Source : How to to avoid referencing a dll's referenced dll
Side note : I use C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5.1\System.Runtime.WindowsRuntime.dll and C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd.
May be related : Could not load file or assembly Windows.winmd and How to reference Windows.winmd from a .NET Core library?
After some more research, and with the hint given by Hans Passant, I finally understood that I had chosen the wrong System.Runtime.WindowsRuntime.dll to start with. Changing it to use C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Runtime.WindowsRuntime.dll instead in both the project with the DLL and the project using it, resolved my problem.
I got the new file location here : C# “await” error when using WinRT from Desktop app
I am now dealing with a existing solution in VS2012.
Now I can execute it in debug mode but cannot trigger some of the function with the error
"Exceptions: System.Exception: Could not load file or assembly
'Interop.Score, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=5ce8a8a190705d24' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)"
After finding some of the suggestion, some of that suggest me to compile the solution in 32-bit (x86).
However, when I tried to rebuild with the target platform x86, another type of error occur and I even cannot run in debug mode, the error:
Referenced assembly 'GenCode128.dll' is not a valid assembly C#
P.S. GenCode128.dll is one of the error .dll, there is at least 2 of this kind of error.
I cannot search any successful way to solve this problem, appreciate for any help.
You can use a decompiler such as DotPeek (https://www.jetbrains.com/decompiler) to look inside your DLL and see if it is a valid .NET DLL -- and which version of .NET it is. It could be an x64-compiled assembly; in that case you cannot use it on a 32-bit system or from a 32-bit-compiled .NET assembly.
You can try installing it from NuGet.
I've created a NuGet package for GenCode128.dll here: https://www.nuget.org/packages/GenCode128/
Also the source can be found in GitHub: https://github.com/SourceCodeBackup/GenCode128
I found a problem within Entity Framework. I downloaded the code and fixed the issue, and finally compiled the assemblies.
Now i have been struggling for hours but I can't figure out HOW to use my assemblies in my project. I tried to overwrite the assembly in the packages folder but whenever I try to execute commands from the package manager I get errors like
"Unable to load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one .... The assembly's manifest definition does not match the assembly reference. (Eccezione da HRESULT: 0x80131040)".
The same happens when running my project.
EDIT:
I tried also to find and replace any revelant (not all) occurrences of Microsoft PublicKeyToken in EntityFramework.dll, EntityFramework.PowerShell.dll and replace them in packages folder. Nothing. Tried to modify any references in .csproj, app.config. nothing.
How can I solve the problem and use my EntityFramework.dll both in project and Package Manager?
Thanks