Message 1 of 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've added ClosedXML to my plugin for AutoCAD 2025 using .NET 8.0. I can still compile and run my plugin. But when I launch a command that uses a method from a class that requires ClosedXML, I get an exception while debugging
System.IO.FileLoadException
HResult=0x80131621
Message=Could not load file or assembly 'ClosedXML, Version=0.104.1.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
I've already verified that my .dll and the .dll of ClosedXML and it's dependencies are all present in the same folder.
I'm wondering if its a problem that ClosedXML is targeting .NET Standard?
I've also tried to do Assembly.LoadFrom("ClosedXML.dll") in the command before calling the method that requires ClosedXML, but had the same exception occur.
Here is the command and the code it's calling
[CommandMethod("MyTools", nameof(Test), CommandFlags.Modal | CommandFlags.UsePickSet)]
public void Test()
{
Editor ed = _doc.Editor;
Database db = _doc.Database;
using Transaction tr = _doc.Database.TransactionManager.StartTransaction();
CSVExporter.Export(new Project.Project(_doc, tr));
tr.Commit();
}
public class Project(Document doc, Transaction tr)
{
public Document Document { get; } = doc;
public Transaction Transaction { get; } = tr;
}
public class CSVExporter
{
public static void Export(Project.Project project)
{
if (!project.Document.CreateDirectory("data", out var path))
{
project.Document.Editor.WriteMessage($"\nProblem finding or creating data folder.");
return;
}
string fullFileName = Path.GetFileName(project.Document.Name);
string fileName = Regex.Replace(fullFileName, @".dwg$", ".xlsx", RegexOptions.IgnoreCase);
string newPath = Path.Combine(path, fileName);
using var workbook = new XLWorkbook();
var mainWorksheet = workbook.AddWorksheet("WCS");
workbook.SaveAs(newPath);
}
}
Solved! Go to Solution.