Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Value of type '<typename>' cannot be converted to <typename>

I'm working on a project that uses the testing tool built into VS 2008.

Periodically I will see an error comparable to: Value of type 'AcademyPro.Code.BLL.Appearance' cannot be converted to 'AcademyPro.Code.BLL.Appearance'. Type mismatch could be due to the mixing of a file reference with a project reference to assembly 'AcademyPro'. Try replacing the file reference to 'academypro.dll' in project 'AcademyPro' with a project reference to 'AcademyPro'.

Now, on one level the error is correct, there is a project reference (required for the code to compile) and a file reference (in a file called AcademyPro.accessor)

If I remove either of these references then the test project fails to compile. I have tried removing both references, cleaning the build and adding them back in. this doesn't seem to help.

It seems I'm in a lose lose situaltion, I need the project reference to compile and I need the accessor reference so that the private object accessors are built, which I need to be able to compile.

What do I need to do to get this compiling again?

like image 575
ilivewithian Avatar asked Dec 02 '25 05:12

ilivewithian


2 Answers

After much digging around I discovered that the project I was trying to test (not the unit test project) has a project reference to itself. I don't know why or how it would have a reference to itself, but it did. I removed this reference and now everything compiles properly.

like image 74
ilivewithian Avatar answered Dec 04 '25 14:12

ilivewithian


I also got the same problem, i fixed it by remove all the references of the project, reopened solution again and then added the references, it worked for me. (Got this solution from google)

like image 23
developer45 Avatar answered Dec 04 '25 13:12

developer45