How can I fix this exception I get when I try to use the FxCop introspection engine? - fxcop

I am getting an exception when I try to use the FxCop introspection engine:
Could not load file or assembly 'Microsoft.Cci, Version=9.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
An attempt was made to load a program with an incorrect format.
What does this exception mean and how can I fix it?

Ok, fixed it. FxCop assemblies are 32bit, my project was 64bit. Changed the build to x86 and the problem is fixed.

Related

C++/CLI managed code exception

I made a wrapper for some sdk written in C# using C++/CLI to be used with a c++ program. The managed code project has "Common Language Runtime Support (/clr)" enabled in Visual Studio and .Net Target Framework set to v4.5.2.
My problem is that I receive the below exception:
"System.IO.FileNotFoundException: 'Could not load file or assembly 'Test, Version=1.0.6.52, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
I can't reproduce this all the time on the same machine, more of the time is working well.I also checked for test.dll in running directory and it's there.
Thank you.

Could not load file or assembly 'AspNet.Loader, Version=1.0.0.0'

im using ASP.NET 5 MVC6, and i am getting this error whenever i try to run application:
An attempt was made to load an assembly from a network location which
would have caused the assembly to be sandboxed in previous versions of
the .NET Framework. This release of the .NET Framework does not enable
CAS policy by default, so this load may be dangerous. If this load is
not intended to sandbox the assembly, please enable the
loadFromRemoteSources switch. See
http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
and when i dive a little deeper in error i find this:
Could not load file or assembly 'AspNet.Loader, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies.
Operation is not supported.
I tryed googling it, but no luck, any ideas?
Thanks in advance!
I have had this issue when deploying to Azure as well. My only solution was to make sure the file and permissions on the folder wwwroot/bin are such that the server can see and access this directory.

Error loading a 3.0 framework dll Unity

I am trying to load a managed dll into my project. C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.ServiceModel.dll
Its an Empty project. I paste this dll into my Asset/Plugin folder. I compile for Windows8 (Universal App)anyway it fails with all SO. I change API Compatibilty level to 2.0. It seems its load without problem. As soon as I play Unity the following mistake appears:
SpritePacker failed to get types from System.ServiceModel,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxx.
Error: The classes in the module cannot be loaded.
UnityEditor.Sprites.Packer:GetSelectedPolicyId()
Somebody with this problem?
Finally it worked out loading the dll from:
"C:\Program Files (x86)\Unity\Editor\Data\MonoBleedingEdge\lib\mono\gac\System.ServiceModel\3.0.0.0__b77a5c561934e089"
Other dlls where not valid. The reason why it is like this I do not know it.

SharpSVN error in VS2010

I'm trying to get SharpSVN to work with a VB.NET project I'm working on in VS2010. I've added SharpSVN.dll to my project references but the following error appears when I try to load the site:
Could not load file or assembly 'SharpSvn' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'SharpSvn' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
My machine is 64-bit, and I've set the Configuration Manager to build to x64 as well as copied the 64-bit version of SharpSVN.dll into my project's bin directory. Additionally, I've also tried setting build to x86 and using the x86 version of SharpSVN.dll and the same error appears (so I suspect the error may not be directly related to instruction set family).
In my config file, I've tried adding the following to the assemblies attribute:
<add assembly="SharpSvn, Version=1.6016.1637.10768, Culture=neutral, PublicKeyToken=d729672594885a28"/>
Any ideas?
I have the same error and can't explain what's going on. However, with the 32bit version, the error is more descriptive:
Unhandled Exception: System.IO.FileLoadException: Mixed mode assembly is built against
version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without
additional configuration information.
Which you can fix by adding the following snippet to your app.config
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
Not sure what's wrong with the 64bit version, but you can always build it from source.
Despite thinking that <add assembly> was enough, I actually solved this issue by adding SharpSvn to GAC (in case anybody is running into this problem as well).
I am not sure why adding to the GAC worked for you, this is not the correct behavior for the assembly loader.
The error refers to the bitness of an assembly. SharpSVN is a mixed mode assembly, ie: it contains both managed and unmanaged code. You must specifically target x86 (with the x86 SharpSVN Assembly) or x64 (again with appropriate assembly). You must further set all your assemblies to be explicitly x86 or x64. Targeting Any CPU will allow the runtime to make this decision for you, and it will fail to load SharpSvn.dll if it picks a word length that does not match the SharpSvn DLL.

msbuild task error while loading Microsoft.VisualStudio.Coverage.Analysis

I've written a custom task for analyzing code coverage results. While building the entire solution, I get the following error.
error MSB4018: System.IO.FileNotFoundException: Could not load file or
assembly 'Microsoft.VisualStudio.Coverage.Analysis, Version=9.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find
the file specified.
I checked the path specified during the build process and the dll location is correct. Yet, i get a FileNotFoundException.
Am I missing something?
Thanks...
This may sound like a silly suggestion, but have you checked that you're running the Visual Studio 200X Command Prompt and not the Visual Studio 200X x64 Cross Tools Command Prompt ?
I managed to fix the problem. I had to add the assembly to the GAC using gacutil.exe. The error vanished once the assembly was added.