6
votes

I've installed VS 2015 (not the RC though I had that installed prior). I opened an existing solution that was working fine in VS 2013 and got the following error.

BC30652 Reference required to assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' containing the type 'EntityObject'. Add one to your project.

I added a reference to System.Data.Entity in the project as VS suggested and it worked. However, I'm wondering why this happened.

If I remove System.Data.Entity reference, VS 2013 still works but VS 2015 throws errors. The project does have a reference to System.Data.

Notes about the solution:

  • Originally developed in VS 2013
  • .NET 4.0
  • Also has reference to System.Data
  • Has 2 projects, a main (which causes the error) and a DAL
  • The DAL has an Entity Data Model (.edmx)
1
This is just a shot in the dark but this could be due to a change on how the compiler deals with transitive dependencies. E.g. let's say that your project A depends on a library B and that B exposes a public type C that derives from EntityObject. Then whether A needs a reference to Entity Framework will generally depend on what it does with the class C. Unfortunately there are no hard rules on how this works and it might depend on the implementation of the compiler. Since VS 2015 and .NET 4.6 come with new C# and VB compilers the rules might have changed in subtle ways. - divega
@divega Do you know of a way I could test your shot in the dark? - Tony L.
First, can you confirm that your application depends on a library that exposes a public type that derives from EntityObject? If yes, can you add more information in your question about how application's code interacts with that type? With that information it might be possible to create a simple repro (which shouldn't need to involve EF) we can bring up to the language folks. It might also be possible to come up with a workaround so that you don't need to add the reference if that is what you are after. - divega
I can confirm that VS 2015 breaks transitive dependencies, at least for me. I have a simple solution where project A references library B, which in turns references library C. Project A does not reference library C directly, but uses a type from it trough library B. This properly compiles and run in every VS since 2003, but not in 2015. I get the same error code BC30652 - Petar Slavov
The project that caused the error references a data access layer. The DAL has an entity data model. I think you guys are on to something. - Tony L.

1 Answers

9
votes

I got confirmation from the Visual Basic language team that this is very likely due to a change in their compiler in Visual Studio 2015:

... we actually did work to try to make things more permissive. But the summary is that the compiler may require more references for correctness. Add them if you can. I believe there is a quick fix for it if you invoke the light bulb.