var c = CsScript.Compile(code, r: new[] { @"D:\RPA\spire\10.6.0\NET9.0\Spire.Doc.dll" }); //beforeHowever, after execution, it still reports that the DLL cannot be loaded. How should I resolve this?
// script "cs_spire.doc.cs"
/*/ r D:\RPA\spire\10.6.0\NET9.0\Spire.Doc.dll; c CsScript.cs; /*/ //.
script.setup(trayIcon: true, sleepExit: true);
//..
print.clear();
string code = """
using Spire.Doc;
using Spire.Doc.License;
using System;
string sDir = @"C:\Users\Administrator\Desktop";
string sTxt = "hello world!";
string sName = "hello.docx";
newDoc(sDir, sTxt, sName);
void newDoc(string sDir, string sTxt, string sName)
{
Environment.CurrentDirectory = sDir;
var doc = new Document();
var section = doc.AddSection();
var paragraph = section.AddParagraph();
paragraph.AppendText(sTxt);
doc.SaveToFile(sName, FileFormat.Docx2016);
}
""";
//var c = CsScript.Compile(code, r: new[] { @"D:\RPA\spire\10.6.0\NET9.0\Spire.Doc.dll" }); //before
var c = CsScript.Compile(code); //after
if (c == null) return;
c.Run();