不知道大家是否知道excel-dna项目,这是一个帮助将.net汇编和语言集成到excel addins中的项目。
我的问题是我想从 xll 文件中解压一个 dll(excel-dna 能够将资源打包到 xll 中)。
我下载了 excel-dna 源并且已经在源代码的基础上编写了这个:
string xlllib = @"C:\pathtomyxllfile\myaddin.xll";
string xlloutput = @"C:\pathtomyxllfile\myaddin.dll";
var hModule = ResourceHelper.LoadLibrary(xlllib);
var content = ResourceHelper.LoadResourceBytes(hModule, "ASSEMBLY_LZMA", "MYASSEMBLYNAME");
using (BinaryWriter binWriter = new BinaryWriter(File.Open(xlloutput, FileMode.Create)))
{
binWriter.Write(content);
}
但它不起作用。 任何人有从 xll 解压 dll 的想法吗?
提前致谢,
最佳答案
如果您希望从 Excel-DNA 加载项中提取 .NET 程序集,我编写了一个名为 ExcelDnaUnpack 的小实用程序。 强>。源代码在 GitHub 上:https://github.com/augustoproiete/exceldna-unpack
ExcelDna-Unpack is a command-line utility to extract the contents of ExcelDna add-ins packed with ExcelDnaPack
Usage: ExcelDna-Unpack.exe [<options>]
Where [<options>] is any of:
--xllFile=VALUE The XLL file to be unpacked; e.g. MyAddIn-packed.xll
--outFolder=VALUE [Optional] The folder into which the extracted files will be written; defaults to '.\unpacked'
--overwrite [Optional] Allow existing files of the same name to be overwritten
Example: ExcelDna-Unpack.exe --xllFile=MyAddIns\FirstAddin-packed.xll
The extracted files will be saved to MyAddIns\unpacked
关于c# - 从使用 Excel-DNA 构建的 Excel .XLL 文件中解压内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7402209/