MVVM Light Issue - c#

I have both GalaSoft.MvvmLight.Extras.WPF4 and GalaSoft.MvvmLight.WPF4 referenced in my project, however if I declare the following namespace (which does not appear in the drop down list - neither do)
xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command; assembly=GalaSoft.MvvmLight.Extras.WPF4"
I get the following error
Error 1 Unable to load the metadata for assembly 'GalaSoft.MvvmLight.Extras.WPF4'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'GalaSoft.MvvmLight.Extras.WPF4, Version=3.0.0.30137, Culture=neutral, PublicKeyToken=e80d33351f9dc0a2' or one of its dependencies. The system cannot find the file specified.

You downloaded the DLL from the web, and so it is marked (via NTFS alternate data streams) as such. Executables and other binaries are blocked by the system automatically in this case.
You need to unlock the file. Assuming you got it from a legit source (I'd assume not) you simply right-click on the DLL and click the "Unblock" button at the bottom of the form.

Related

Could not load file or assembly or one of its dependencies - searching in wrong folder?

My code was working and out of no where I am starting to get this:
System.Windows.Markup.XamlParseException: 'Could not load file or assembly 'Syncfusion.SfGrid.WPF, PublicKeyToken=3d67ed1f87d44c89' or
one of its dependencies. The system cannot find the file specified.'
FileNotFoundException: Could not load file or assembly 'Syncfusion.SfGrid.WPF, PublicKeyToken=3d67ed1f87d44c89' or one of its
dependencies. The system cannot find the file specified.
I ran fugslovw as recommended from other posts but cannot figure out how to solve this. It seems the assembly protocol is looking for Syncfusion.SfGrid.WPF.dll in the wrong directory. Syncfusion.SfGrid.WPF.dll is in the /bin/Debug folder so why isnt it searching there similar to other assemblies it found? I got this dll from nuget package and they are the same version accross my entire project. I also tried cleaning my solution. Any hints please? I have attached the two failing logs here and here. An example of a successful log which I expect is here
Probably the application (ETABS) loads your DLL with Assembly.LoadFrom, therefore resolving the dependencies works at this point in time.
When later WPF tries to load additional dependencies, it does not know about the location of your plugin and thus does not consider your bin directory.
We had a similar problem with a plugin architecture and solved it by pre-loading all required depedencies before the WPF control is created, e.g. by
_ = new AnyTypeFromTheAssembly();

Could not load file or assembly 'Interop.ADOX

I am adding reference to Interop.ADOX.dll in my class library project "ABCD" in C#. When I built the project it builds fine. I can also access classes and functions provided by Interop.ADOX.dll.
But when I run the exe which uses my dll "ABCD", it throw error :
"Could not load file or assembly 'Interop.ADOX, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
I tried creating a separate sample class library and adding reference to the Interop.ADOX.dll and that works fine. No errors. So there is nothing wrong with the Interop.ADOX.dll file.
Also I know somehow in my project structure it is not able to find the Interop.ADOX.dll file and hence unable to load it.
So far I tried copying them at all the possible locations that I thought it might be
trying to access it from but that did not work...
Any suggestions that I can try out?
I found out something. In the project properties, Build Tab, when I chose platform target as any CPU then it throws error. But if I chose x86 it works fine. Why?

The system can not find the dll

I converted my console app to Class Library project so that I can use dll again for multiple project. I am getting an error
Could not load file or assembly 'System.Net.Http.Primitives,
Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f711d50a3a' or
one of its dependencies. The system can not find the file
I've already tried the solution mentioned here: Could not load file or assembly System.Net.Http.Primitives. Located assembly's manifest definition does not match the assembly reference.
But no luck. Any suggestion
1- check if you are referencing an assembly which in turn referencing an old version of unity. for example let's say you have an assembly called ServiceLocator.dll which needs an old version of Unity assembly, now when you reference the ServiceLocator you should provide it with the old version of Unity, and that makes the problem.
2- may be the output folder where all projects build their assemblies, has an old version of unity.
you can use FuseLogVw application to find out who is loading the old assemblies, just define a path for the log, and run your solution, then check (in FuseLogvw) the first line where the Unity assembly is loaded, double click it and see the calling assembly, and here you go.
Your problem posted here previously: Could not load file or assembly or one of its dependencies
Please search before rising your question. Thanks
try right click -> Properties -> Build Action -> Embeded Resource should make it work
I will show you clearly the mean of Lucky Lefty. In Solution Explorer, right click on you .dll file and choose properties. The properties pane appears then on Buil Action option, you choose Embeded Resource. After that, you rebuil your solution.
You can view more information from here: http://www.codeproject.com/Articles/528178/Load-DLL-From-Embedded-Resource
Remember: Google search is your best friend.

VS2012 dll file not found at run time

I have a project that references a dll file. I simply added a reference by right clicking on the properties, selected add reference, and browsed for the dll. Intellisense recognizes the library and all it's classes/methods but when I run it I get this.
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in program.exe
Additional information: Could not load file or assembly 'Api.dll' or one of its dependencies. The specified module could not be found.
The file appears in the bin folder and is still at the location I browsed too. The program runs without errors if I don't use any classes or methods. The library doesn't have any dependencies I'm aware of.
Edit: found a lot of missing dependent DLL files using dependency walker that I thought were causing the problem. After putting all the dependent DLL's in the same folder and referencing it the problem persists
Run Fusion Log Viewer when you run your app. It will tell you exactly what assembly isn't loading.
If nothing shows up in Fusion Log Viewer when you run it, try these settings:
I never did understand why results wouldn't show up unless I used the settings this way. I would delete all entries, run the app, then hit the Refresh button.
Turns out that even once I found the missing DLL's using dependency walker that they weren't being imported into my project with the original DLL. Moving them into the bin/debug folder fixed the error

Microsoft.Expression.Drawing.Aero missing (what is it?!)

I have a window and I created a "callout" there. When I try to create the new window with this.InitializeComponent(); I get an exception:
The assembly with display name 'Microsoft.Expression.Drawing.Aero' failed to load in the 'Load' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Expression.Drawing.Aero, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
How can it be? What is Microsoft.Expression.Drawing.Aero?
The solution can be delete your .suo file and ReBuild your entire solution.
The *.suo file is found in the project root folder.(If you can't see your *.suo file be sure you have configured the windows explorer to see hidden files.)
That is part of the Expression Blend SDK and means that some part of the project has been built via Expression from MS - the SDK itself is AFAIK a free download. Just download and install it to resolve the described situation.
Well, I cannot tell you exactly what did it, but I ran a full purge on non-sourced files and it now works....So, it wasn't the suo, but it was something...
I am just making wild guess. Since the exception is thrown while initializing the Window I assume that the application is trying to load the Aero theme from your machine (I guess Windows 7). See if there is any style defined for the windows which asks it to use Aero theme irrespective of the theme set being used by the OS.
Maybe you are missing Expression Blend SDK (that Dll is part of it)?
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=75e13d71-7c53-4382-9592-6c07c6a00207
If you are using multiple project in single solution, this exception will occurs. I removed my project from solution and ran it separately it works.

Categories

Resources