问题描述
我正在尝试在我的 .net core 2.0 解决方案中加载已编译的 XSL(使用 XSLTC.exe),但出现以下错误.
I am trying to load compiled XSL (using XSLTC.exe) in my .net core 2.0 solution but getting below error.
System.IO.FileNotFoundException: '无法加载文件或程序集'System.Data.SqlXml,版本=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089'.系统找不到指定的文件.'
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Data.SqlXml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.'
Assembly asm = Assembly.LoadFrom(@"...");
Type t = asm.GetType("...");
myXslTransform.Load(t);
文档说,它应该加载从 XSLTC.exe 生成的文件但不工作.
The documentation says that, it should load file generated from XSLTC.exe but not working.
有什么我遗漏的,请帮忙.
Is there anything I am missing, please help.
推荐答案
.NET Core 没有 System.Data.SqlXml 或当前等效的 Microsoft.Data.SqlXml 作为内置或开箱即用的程序集包.包含允许读取普通 SqlXml 数据的 SqlXml 类的包/程序集 .NET Core 是 System.Data.SqlClient,可在 .NET Core 1.0 或更高版本中使用.
.NET Core does not have System.Data.SqlXml or current equivalent Microsoft.Data.SqlXml as an in box or out of box assembly package. Package/assembly .NET Core which contains SqlXml class allowing to read plain SqlXml data is System.Data.SqlClient and is available in .NET Core 1.0 or later.
要获得更高级的功能,您需要使用 Microsoft.Data.SqlXml,它既未随 .NET Framework 也未随 .NET Core 一起安装.目前获得它的最佳方法是通过安装 SQLXML 4.0 SP1 包 - 最新的 Mirosoft.Data.SqlXml 版本最有可能是 4.0.3.从 SQL Server 2008 开始,SQL Server 中不包含最新版本的 SQLXML.
To get more advanced functionality you need to use Microsoft.Data.SqlXml which is not installed neither with .NET Framework nor .NET Core. Currently best way to get it is via installing SQLXML 4.0 SP1 package - latest Mirosoft.Data.SqlXml version is most probable 4.0.3. Beginning with SQL Server 2008, the latest version of SQLXML is not included in SQL Server.
这篇关于XslCompiledTransform.Load(type):无法加载文件或程序集“System.Data.SqlXml"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!