views:

74

answers:

3

We have a function in a VS2005 project that loads assembles and get type information from them . It does not instantiate these types though. We tried to load some assembles that are compiled in 2010, but keep getting the following exception.

"Could not load file or assembly '2010ClassLibrary' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

Is there anyway to get around this?

+5  A: 

If you are not using any .Net 4 features in your code in the VS2010 solution, then set your target for the solution to be .Net 2.0 instead. This will allow you to reference it in VS2005. .Net 3.5 can be used in VS2008.

Mikael Svenson
A: 

Thanks your reply. But we don't own those 2010 assembles

fwiw, please add a comment instead of another answer when you want to reply to an answer :)
James Manning
+1  A: 

you could run the app under .net 4 and then the code to load the assembly should be fine.

http://msdn.microsoft.com/en-us/library/f4kkd0k5.aspx

James Manning