问题描述
我使用的是 Saxon 10.5 版 .net 评估版。尝试编译 xsd 时抛出以下错误。
找不到方法:'Void System.IO.FileStream..ctor(System.String,System.IO.FileMode,System.Security.AccessControl.FileSystemRights,System.IO.FileShare,Int32,System.IO.FileOptions) '.
Processor processor = new Processor(true);
processor.SetProperty("http://saxon.sf.net/feature/timing","true");
processor.SetProperty("http://saxon.sf.net/feature/validation-warnings","false"); //Set to true to suppress the exception
SchemaManager manager = processor.SchemaManager;
manager.XsdVersion = "1.1";
manager.ErrorList = new List<StaticError>();
var samplesDir = new Uri(@"C:\saxon samples\samples\");
Uri schemaUri = new Uri(samplesDir,@"data/books.xsd");
try
{
manager.Compile(schemaUri);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
解决方法
我的猜测是您运行的是不受支持的 .NET 版本。
请注意(由于 IKVM 交叉编译器的限制),.NET Core 目前不支持 Saxon。