Adding Reference of a PE file to a Project

Apr 27, 2009 at 12:52 PM

I have been using CCI (Common Compiler Infrastructure - Code & AST components) and I'hv created a mutable assembly.
Then using a PEWriter class, I'hv written a PE file for it. I have saved this file as I load this file using PEReader class it loads it correctly.
But what I want to try is adding this file as reference to one of my projects.
If I name that File as Test.dll(i.e. remove the .pe extension) then also PEReader loads it correctly.Infact I can even explore that dll in the reflector.
But if I try to add the reference of the same (Test.dll) using AddReference then I get the following error message:

A reference could not be added.Please make sure that the file is accessible,and that it is a valid assembly or COM Component.

Any help in this would be appreciated.

Apr 28, 2009 at 5:50 AM
Try running peverify on the generated assembly. If that does not help pin point the problem, try cutting down the size of the generated assembly until you get a small assembly that works.
Apr 28, 2009 at 11:40 AM
Hey hi..
Thanx for your reply..
After I ran peverify.exe my dll is getting added as a reference.I dono what miracle exactly took place.

Thanx again.
Apr 28, 2009 at 3:06 PM
I don't know either. As far as I know, peverify is a diagnostic tool only. I wouldn't bother making it a part of the build process, except, maybe as part of the testing framework. ;-)