sirbombay
sirbombay

Reputation: 419

Can my project reference an assembly targeting a lower version of .net framework?

I'v not been too long on the .net platform.less than 2months. I'm having this "could not load type blah.blah.blah from assembly blah.

So i'v been battling it with several resources including the suggestions in diff post here.Still no luck. but the closest suggestion seems to indicate that some of references might be targeting a lower version of .net. Actually there are many many references targeting different versions and within some of this references there are many more dependent assemblies that possibly are targeting diff versions.

i'v been struggling to convert some of the assemblies i have the source using VS 2010(.net 4.0) and the whole stuff is almost overwhelming me.

And so i'm asking in frustration: MUST MY REFERENCE ASSEMBLIES(and their dependencies) AND MY PROJECT TARGET the same version?

Upvotes: 1

Views: 4277

Answers (2)

Marc Gravell
Marc Gravell

Reputation: 1063338

As long as the libraries target a version that is <= the version your code wants, then that is fine. Note, of course, that any behavior changes could cause subtle bugs, but this is rare - fundamentally it should work ok.

If the libraries target a higher version: bad things.

I suspect more context about the specific "could not load type blah.blah.blah from assembly blah." would be useful.

Upvotes: 6

MSTdev
MSTdev

Reputation: 4635

No it is not necessary REFERENCE ASSEMBLIES(and their dependencies) AND Your PROJECT TARGET the same version.

I think you got another issue for could not load project or assembly.

Keep in mind

1> Add all assembly which is missing

2> don't run 4.0 targeting project in 2008 or lower (don't run higher version project in lower version SDK)

Upvotes: 0

Related Questions