代码在 visual studio 2015 年编译但在 2013 年失败

code compiles on visual studio 2015 but failing on 2013

我在class

中有这个方法
public static DataTable ConvertCellSetToDataTable(CellSet cellSet)
{
    return new DataTable();
}

我的 packages.config 中有 Microsoft.AnalysisServices.AdomdClient 作为 nuget 包,但我没有 System.Xml 作为项目参考。

  <package id="Microsoft.AnalysisServices.AdomdClient" version="12.0.2000.8" targetFramework="net452" />

此项目无法使用 Visual Studio 2013 Pro 编译,但相同的解决方案文件在同一台机器上的 Visual Stuido 2015 Pro 中符合要求。

来自 VS2013 的错误信息如下:

error CS0012: The type 'System.Xml.Serialization.IXmlSerializable' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

我对这次失败没意见,但为什么它用 Visual Studio 2015 编译?这里有什么新内容?

这里有我所有的文件要点:

https://gist.github.com/atwayne/ad8fdc06ee831626361609cfb5935638

已经有一段时间了,我引用@Hans Passant 的评论作为回答:

Roslyn is new. The C# compiler, somewhere around version 4.5, got a lot more strict about wanting to know types that are indirectly referenced. Some kind of method overloading issue, a detail that the C# language specification does not mention.