3

I am getting a build error when I attempt to build my asp.net application. The error is:

The type 'MediCare.Framework.Authentication.IUserAuthenticate' is defined in an assembly that is not referenced. You must add a reference to assembly 'MediCare.Framework, Version=1.0.1.95, Culture=neutral, PublicKeyToken=1999fa3c42b9'.

I can see the class in the library which is in the references folder. How do I debug this issue?
My intention is to point the references folder to the library source code's bin directory (since the pdb file is lcoated there and any updates to the library will reflect in the application). However, when I point the references folder to the bin directory of the source code, I get the error message above.

Update The application was originally developed in VS 2008 and I am modifying it in 2010. I think I am confused about where the GAC assemblies would be, if I am using VS 2010 (2.0 framework location or 4.0 framework location) ? .NET 4.0 has a new GAC, why?

Update (06-26-2012)
The file in the GAC ("C:\Windows\assembly\") has been deleted. But this error is still occuring.

Community
  • 1
  • 1
DNR
  • 3,706
  • 14
  • 56
  • 91
  • Is it the right version? – jrummell Jun 14 '12 at 15:12
  • yes, it is the correct version – DNR Jun 14 '12 at 15:13
  • Have you set the assembly reference to copy locally if not present in your GAC and referenced else where? – Dan Lister Jun 14 '12 at 15:13
  • A few questions: How did you add the reference? Specifically, did you choose the "Browse" tab and then select the dll from it's location on disc in the "Add Reference" dialog? Secondly, how are you debugging? Using Cassini or IIS? Is the dll copied into your bin folder when you build your application? – user1429080 Jun 27 '12 at 06:11
  • Sorry to be picky, but can you confirm it's an error when you *compile* rather than when you *browse* the site? – Simon Mourier Jun 27 '12 at 08:29
  • @SimonMourier it's an error when compiling – DNR Jun 27 '12 at 12:37
  • @user1429080 yes, I chose the "Browse" tab and then selected the dll. I am using IIS. Yes, the dll is copied into the bin folder. – DNR Jun 27 '12 at 12:39

2 Answers2

6

This could possibly be caused by version inconsistencies. Meaning, in order to fix this, I would do a complete clean build of your assemblies (and also an assemblies that might be nested inside an assembly). Just go out cold and do a new build on all assemblies. That should work.

user279521
  • 4,779
  • 21
  • 78
  • 109
2

Go into windows explorer, right click on the DLL file that your project is using that contains this class, and look at the version tab. Make sure version number matches what you see in the error message. My guess is that it won't.

If it does match, then check the GAC and make sure there isn't a different version of the DLL there that it could be picking up. To do that, go to windows explorer, and navigate to c:\windows\assembly. See if that assembly is in there with a different version number. If it is, you may need to delete it from the GAC (use caution though because other apps may depend on it being there).

dcp
  • 54,410
  • 22
  • 144
  • 164
  • The "General" tab in the GAC assembly shows the correct version. The "Versions" tab shows a 1.0.0.1 version. Why would that be? – DNR Jun 14 '12 at 15:35
  • @DotNetRookie - I think the General version is the one you care about (but I'm not 100% sure, I'm not an expert on the GAC). You might want to check out this post as well: http://stackoverflow.com/questions/8828725/how-do-i-force-an-assembly-to-uninstall-from-the-gac – dcp Jun 14 '12 at 15:53