System.Xml.Linq,可移植库和Silverlight

时间:2013-01-31 22:40:44

标签: xml silverlight silverlight-4.0 silverlight-5.0 portable-class-library

我构建了一个引用System.Xml.Linq的可移植类库(profile47,包括Silverlight 5)。我可以从Silverlight 5应用程序中引用该可移植库,我可以在C:\ Program Files(x86)\ Microsoft SDKs \ Silverlight \ v5.0 \ Libraries \ Client中引用Silverlight版本的System.Xml.Linq。问题是System.Xml.Linq dll的版本号(5.0.5.0)与可移植库引用的版本号不同,当我运行Silverlight应用程序时会引发异常:

Could not load file or assembly 'System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

由于app.config中没有像完整.NET框架中那样的程序集重定向机制,有没有办法让它工作?

1 个答案:

答案 0 :(得分:2)

从便携式类库中删除System.Xml.Linq引用。如果你的个人资料中有.net framework 4.0.3,.Net Portable子集就足够了。