views:

475

answers:

2

Hi guys,

I'm having an odd issue with an assembly that is targeting .NET 3.5. When including this assembly via Add References/Browse to DLL - it complains:

"MyAssembly.dll", or one of its dependencies, requires a later version of the .NET Framework than the one specified in the project. You can change the .NET Framework target by clicking Properties on the Project menu and then selecting a new target in the '.NET Framework' dropdown box. (In Visual BVasic, this is located on the Compile tab by clicking the "Advanced Compiler Options..." button.) Do you still want to add a reference to 'MyAssembly.dll' in the project ?

There doesn't seem to be any rhyme or reason to this error - we've tried the "obvious' things.

The Assembly that is consuming the DLL is .NET 3.5. The DLL is .NET 3.5. All of the assemblies that each are using - are .NET 3.5. Nothing is using .NET 4.0 [AFAIK]

What things can I check/do ? There is some COM Interop in the DLL - could that be it ? This project was moved from VS 08 to VS 10 - but again, still targets .NET 3.5. I verified that all of the assemblies listed under Reference target the right CLR version [2].

Upgrading the target project to .NET 4 does remove the issue - but this isn't something we're able to do at this time.

  • I should also note that including it via References/Project [same solution] does seem to work - when downgrading the DLL to .NET 3.0. [this may not be entirely accurate - was testing quite a few things]

I'm out of ideas at this point.

Thank you!

  • Matthew
A: 

I'm assuming that you already used Reflector or ILDASM to check the Manifest of the assemblies that are causing the problem.

One option you have is to ignore the message and add the reference anyway. Then try to use any type in the assembly. You should get a more complete error message.

For example, this is the error I get in my computer when I try to reference a class library that is targeting a higher framework:

The primary reference "ClassLibrary2" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework. ConsoleApplication1

Hope that helps pinpoint the problem.

krolth
A: 

It turns out that the issue is.. oddly enough.. with Janus Controls .NET 3.5 components.. do not play well with others it seems.

As of today, the Janus Controls [GridEX] do not work with VS 10 & .NET 3.5, ... only with .NET 4 projects, even if the solution was built in .NET 3.5 and VS 2008. Sigh

  • Matthew
Matthew M.