FxCop fails to analyse the indirectly referenced assembly - .net-assembly

Metrics.exe: error: The referenced assembly 'Exception.dll, version=1.0.5289.9, Culture=neutral, publickeytoken=67er8..' could not be found. This assembly is required for analysis and was referenced by
\bin\cancel.dll.
But the assembly it is trying to refer to (Exception.dll) is GAC'd. i.e, present in the C:\windows\assembly.
I have around 300 project files.. Copying the assembly to each project will be a cumbersome process..
Is there any workaround?

*Important: Check the assembly versions.
The assembly Exception.dll was of an older version in GAC. But the assemblies trying to refer this assembly was of another version. Simply GACd the newer version of the assembly - Exception.dll in the GAC and it worked :-)

Related

Error Running Code Analysis in VS2012: Could not resolve type reference

When I click the Run Code Analysis project context menu item. Building starts, but stops with following error:
CA0001 Error Running Code Analysis
CA0001 : The following error was encountered while reading module 'EntityFramework':
Could not resolve type reference:
[System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]System.ComponentModel.DataAnnotations.Schema.ColumnAttribute. [Errors and Warnings] (Global)
Analysis on other projects works well. How to eliminate this problem?
I tried the solution mentioned by Scott Wylie. I tried adding a reference to System.ComponentModel.DataAnnotations in my project but that did not help.
I then tried copying and pasting the System.ComponentModel.DataAnnotations.dll directly into my bin folder and that did the trick. Add the dll into your local bin folder, publish the solution, then manually add the dll into the bin folder of your published project (if it didn't copy up on its own).
The System.ComponentModel.DataAnnotations dll may not be used by your application but it is internally referenced by EntityFramework.dll. Code Analysis will look at all of your referenced dll's and try to resolve their references too. If you add the System.ComponentModel.DataAnnotations.dll to your application, this error will go away next time you run Code Analysis.

MT5202 Native linking failed Undefined symbols for architecture armv7:

I have been having this issue for a number of days now, and have been unable to make any headway on it.
I have a native Obj-C library that i am trying to bind using a MonoTouch binding project. The binding Dll is created, but when i import it to an app and try to compile I get a MT5202 Native linking failed error.
Reading the build output shows that the symbols for the iOS version i am compiling for are missing.
Undefined symbols for architecture armv7:
with the build output showing a number of linking issues (only a few shown)
"_CVPixelBufferGetPixelFormatType", referenced from:
-[DecodePickerController captureOutput:didOutputSampleBuffer:fromConnection:] in libQuickMarkSDK.a(DecodePickerController.o)
-[QMImageUtil saveToAlbum:] in libQuickMarkSDK.a(QMImageUtil.o)
"_CVPixelBufferGetPlaneCount", referenced from:
+[QMImageUtil imageBufferSave:f:] in libQuickMarkSDK.a(QMImageUtil.o)
+[QMImageUtil imageBuffer:zoom:w:h:f:] in libQuickMarkSDK.a(QMImageUtil.o)
"_CVPixelBufferGetWidth", referenced from:
-[DecodePickerController captureOutput:didOutputSampleBuffer:fromConnection:] in libQuickMarkSDK.a(DecodePickerController.o)
-[QMImageUtil saveToAlbum:] in libQuickMarkSDK.a(QMImageUtil.o)
"_CVPixelBufferGetWidthOfPlane", referenced from:
+[QMImageUtil imageBufferSave:f:] in libQuickMarkSDK.a(QMImageUtil.o)
"_CVPixelBufferLockBaseAddress", referenced from:
-[DecodePickerController captureOutput:didOutputSampleBuffer:fromConnection:] in libQuickMarkSDK.a(DecodePickerController.o)
"_OBJC_CLASS_$_AVCaptureDevice", referenced from:
objc-class-ref in libQuickMarkSDK.a(QuickMarkCameraUtil.o)
"_OBJC_CLASS_$_AVCaptureDeviceInput", referenced from:
objc-class-ref in libQuickMarkSDK.a(QuickMarkCameraUtil.o)
To begin with I thought it was just an error with the bindings. So I rebuilt the bindings. No joy. So to test a theory I tried to use the RedLaser mono bindings available from github. This also provided the same error. (if -unsafe is removed from the makefile).
the linkwith statement for the library I need to bind is
assembly: LinkWith ("libQuickMarkSDK.a", LinkTarget.ArmV7, ForceLoad = true, Frameworks = "AVFoundation CFNetwork CoreMedia CoreVideo libz.1.2.5.dylib MobileCoreServices QuartzCore Foundation SystemConfiguration")]
and the Monotouch addition flags being used is -cxx
I have read alot of the other issues but nothing has helped to solve the issue, any help would be great.
You did not state any version numbers (iOS, Xcode, MonoTouch...) so it's a bit hard to give a specific/definitive answer.
That situation can happens when you update a project to iOS6 / Xcode 4.5 where support for ARMv6 was removed. If your native libraries only included ARMv6 then they (the native library, not the binding project) will need to be recompiled for ARMv7 (since it's now a requirement).
To check this please try doing (include the full path to your native library):
file libQuickMarkSDK.a
That should tell you the architectures that your native library supports. Those needs to match the LinkTarget you provide in your binding project (otherwise you'll get errors from the native linker).
Did you try poupou's suggestion in his last comment? I had the same error when compiling for iPhone but not for Simulator. I found that it was a number of missing Frameworks in the LinkWith section. To work out which Frameworks were missing, I googled (for example) CVPixelBufferGetWidthOfPlane Framework.
Credit for this answer goes to cheeesus: MonoTouch Build: ld: symbol(s) not found for architecture armv7

SharePoint Behaved Types - Run Pex Explorations error (System.Moles 4.0.0.0)

I was following a tutorial on pex and moles (http://research.microsoft.com/en-us/projects/pex/pexsharepoint.pdf). Its a year old, but everything worked fine until I changed Mole types to Behaved types. Once I did that, 'Run Pex Explorations' command started throwing this exception:
Could not load file or assembly 'System.Moles, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0ae41878053f6703' or one of its dependencies. The system cannot find the file specified.
I tried multiple solution (including Moles and SharePoint Behaviour types). I also tried to generate Moles for System 4.0.0.0 assembly, but that fails with multiple 'cannot find suitable method to override' errors.
I'm using the latest version on pex (0.94) and moles (1.0.0.0). Is there any solution for this?
Just create a mole for System this way:
<Moles xmlns="http://schemas.microsoft.com/moles/2010/">
<Assembly Name="System" ReflectionOnly="true" />
<StubGeneration Disable="true" />
</Moles>

Error while compiling a library in C#

I am trying to compile a class(sqlAccess) declared as public with few methods related to database connection in it. I am getting the following error ...
Error 1 Friend access was granted to 'SqlAccess, PublicKey=00c8', but the output assembly is named 'SQLAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Try adding a reference to 'SqlAccess, PublicKey=00c8' or changing the output assembly name to match. c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.dll SQLAccess
What could be the reason? is there already a method of that name? I am new to programming so am unable to understand this clearly. Thank you.
This worked for me:
Open the Properties|Signing Tab. Ensure that you have "Sign the Assembly" checked and the strong name key file referenced. Save and compile the Project/Solution.
(cited from MSDN)
.NET seems to get grumpy if you give your assembly/project a name that isn't unique. In your case, SqlAccess must already exist in .NET or a referenced assembly.
The fix is to rename your assembly.
Similar issue:
Weird error in C#
That's because SqlAccess assembly has a reference which granted internal access to SqlAccess. It must be something like this [you will find it in AssemblyInfo.cs] :
[assembly: InternalsVisibleTo("Name of assembly goes here, PublicKey=")]
During compile time when compiler can not find assembly with specific PublicKey, you will get the error such as 'Friend access was granted to...'.
In order to resolve this problem one solution is to remove above attribute from source assembly, or add new public key and change it in source assembly.
Reason behind this should be either you have reinstall/update that particular dll within your solution and but old dll was not deleted properly from your solution and system.
That's why, it got worked when you change the Assembly name (from sqlAccess to sqlAccessXYZ)
I changed the Assembly name to sqlAccessXYZ and now its working, the problem is with the name. Not sure what exactly the problem, for now the issue is resolved. Thanks.

monodevelop insists on using a reference that doesn't work

I am using MonoDevelop 2.2 from the Debian testing repository. I have installed the addins for GTK support, for version 2.8 and 2.10.
When I compile my solution, I get warnings saying Warning: Assembly 'glade-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f' not found. Make sure that the assembly exists in disk. If the reference is required to build the project you may get compilation errors. (ProCos)
The warning is perfectly alright, because the installed libraries do not offer V2.10 of glade-sharp. So I open the reference dialog, remove the reference and insert a reference to V2.8 of glade-sharp (which does exist). Close the reference dialog and recompile. And bang, same warning and the reference has been changed back to V2.10.
Anybody have any ideas how to fix this? Or is this a known bug in that version of MonoDevelop?
If you're using the GTK version support, all the GTK-related assemblies should have the same version. I suspect that if gtk-sharp.dll is 2.10, then MD will "fix" glade-sharp to 2.10 too. In project options is a dropdown for picking the GTK version; using this will update all GTK assemblies to a specific version.
Note also that you can use the project pad to set a reference to not require a specific version.
I suggest trying MD 2.4, and if it's still an issue, please file a bug report.

Resources