Reputation: 153
Why can't I add a reference to System.Runtime.Serialization when targeting .net 2.0?
Also if I convert a vs2005 project using System.Runtime.Serialization the vs2010 conversion fails with a build error.
I'm using the DataContract class and the compiler says
The type or namespace name 'DataContract' could not be found (are you missing a using directive or an assembly reference?) C:\Users\my\ClassLibrary1\Class1.cs 8 6 ClassLibrary1
Upvotes: 0
Views: 1890
Reputation: 63136
The reason for this is that you need to be using .NET 3.5 to use DataContracts, they are items that were introduced with .NET 3.5 therefore you must target that version.
Here is an MSDN article that talks about one aspect of DataContracts and .NET version.
Upvotes: 1