views:

1659

answers:

3

I have a component project build in VS2008 and targeting the .NET Framework 3.5. I recently downloaded the VS2010 Beta 1 to make sure this project would convert over correctly when the time comes to switch to the new IDE. This project contains references to a couple of 3rd party dlls built against version 2.0 of the framework. I changed my project to build against the 4.0 version of the framework but when I try to build the project I get a ton of errors that looks like the compiler can't recognize the class types of those 3rd party libraries similar to what is below.

"The type or namespace name 'Data' does not exist in the namespace 'Microsoft.Practices.EnterpriseLibrary' (are you missing an assembly reference?)"

I'm trying to figure out why I can't compile. From what I have read .NET 4.0 uses a different version of the CLR. How or why would that impact my ability to have access to those types? Am I going to have to

a) Get the source code and recompile in VS2010 / .NET 4.0 and then reference that assembly or

b) Wait for project authors to do "a" above and release their assemblies targeting the 4.0 CLR? or

c) Something else because perhaps my VS2010 install is borked?

I can change the project properties to target 3.5 and everything works as I expect under the 2010 IDE.

+1  A: 

I suspect this is because .NET 4.0 uses CLR 4.0, not 2.0. EL 4.1 will have been built against CLR 2.0, so I'm not sure I'd expect it to be found without help.

John Saunders
I could have sworn I was able to use 1.1 dlls when I started using .NET 2.0 (VS 2005). I don't have it installed anymore, so I can't say for sure though. I would think this situation parallels that one.
sdanna
You were never able to mix .NET 1.1 and 2.0.
John Saunders
I just got a very old version of Log4Net (like from '01, runtime version v1.0.3705) and tried it. Targeting the 2.0 Framework, I was successfully able to compile. Let me be clear, I DO have all the versions of the framework installed on my machine including the beta for 4.0. I was also able to have my project target 4.0 with no issues. I think I'm going to have to chalk this up to a conversion problem, and dig a little deeper into that avenue.
sdanna
When you said "1.1 dlls" I thought you meant Microsoft .NET Framework 1.1. You seem to mean "assemblies originally built against .NET 1.1". Those will work, and they'll bind against the 2.0 assemblies, by default configuration.
John Saunders
A: 

Seems like a CLR versioning issue to me.

For the current time, I will recommend b) and/or just compile to v2.0/v3.5.

Any specific feature that you want to use in v4.0?

Adrian Godong
One of the features I was looking forward to was having the ability to better control my ASP .NET control ID's to make javascript less of a hassle when targeting specific controls.
sdanna
+1  A: 

I wanted to mark this question as answered and based on the comments and my own experiences, I think that Mehrdad is correct in the comment attached to the question and that it was a VS2010 project conversion problem.

sdanna