开发者

VS2010 target .net 2.0 and System.Runtime.Serialization

开发者 https://www.devze.com 2023-01-17 23:24 出处:网络
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 er

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 'DataCo开发者_运维知识库ntract' could not be found (are you missing a using directive or an assembly reference?) C:\Users\my\ClassLibrary1\Class1.cs 8 6 ClassLibrary1


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消