I’m developing a .NET application in C# (.NET Framework 3.5 console application) using Visual Studio 2010. (Win7 64bit) After a machine crash, I copied my project from the old HD to the new one. Now on the new machine, whenever I build, I get the error message:
The type ‘Bloomberglp.AppPortalApi.DataPersistence.ExtensibleDataObject’ is defined in an assembly that is not referenced. You must add a reference to the assembly ‘Bloomberglp.AppPortalAPI, version=1.3.5.1, Culture=neutral, PublicKeyToken=51f5d93763bdb58e’.
It’s attached to the definition of the first method in the “Program” class, which obviously doesn’t mention it.
However, I’m not using this type anywhere in my project, and none of the references in my project are using it either. I had used it previously, but all references to it have been removed…so I thought. I searched for it but can’t find it in any of the .cs files. It’s not findable in the Object Browser either. So where/how should I be looking for it?
Edit: Found C# type defined in an assembly that is not referenced ; there are no references to the the type or the dll in the .csproj
Switching my target between x86 and any cpu and recompiling had no effect, nor did switching back.
This is typically an indirect reference. In other words, you reference an assembly that’s already built and that assembly references a type in the “phantom” one. So you won’t see it at all in your project file. You’d see in the project that built that assembly, certainly some odds that you lost that one due to the crash or just forgot to copy it.
Another classic way to get this problem is by targeting the Client profile, a scourge of VS2010 that selects it by default. If an assembly references a type from an assembly that isn’t part of the Client profile, like System.Web, then it the compiler gets stoopid when the assembly is rejected because it needs an unavailable .NET framework assembly. You get a warning about it, but that’s easily ignored when you focus on the error. Otherwise a good match with the kind of business that Bloomberg is in, it is a webby company. You fix that one by changing the framework target to the full one.