Tuesday, 30 October 2012

Error!!! Could not load file or assembly

When you get this error like I did, and it tells you the assembly file version or error says The located assembly's manifest definition does not match the assembly reference.



you'll have to follow the steps to get the dll files from windows assembly GAC
my example is about the ReportViewer.ProcessingObjectModel version so I'll use this. However you can use whatever is missing dll in your error

Open a command prompt in Administrator mode


Type cd \windows\assembly\gac_msil\Microsoft.ReportViewer.ProcessingObjectModel press Enter

Type dir so it lists the files/folders inside and press Enter and check your required version folder is available


in my case my required version was 11.0.0.0__89845dcd8080cc91 so I typed cd 11.0.0.0__89845dcd8080cc91 and press Enter

you'll be able to find Microsoft.ReportViewer.ProcessingObjectModel.dll in this folder

now we will copy this dll type command copy*.dll c:\dll (or any folder you wish to copy) and press Enter

now the dll is copied to your specified folder and you can use it as a reference in your project folder.