How to add a DLL that references a third party

I want to manually add a reference to a third-party DLL in the script editor, but I don’t want to use the CodeEditExtensions class in the Demo, because it is too large and troublesome. Currently, I only use
Can you simply add a reference? I tried the following methods, but the compilation fails. Please give me some guidance, thank you.
var openFileDialog = new Microsoft.Win32.OpenFileDialog()
Filter = “file (.dll)|*.dll”,
Title = “Add a dll File…”
var result = openFileDialog.ShowDialog();
if (result == true)
var fileinfo = System.IO.Path.GetFileNameWithoutExtension(openFileDialog.FileName);

Yes, you can use csParser.Repository.RegisterAssembly(fullPath);


I assume by compilation errors you mean that the Scripter does not find types defined in this assembly?

If you’d like to specify relative path (or path without extension), you should also specify scriptRun.ScriptSource SearchPaths property

Please take a look at Scripter Quick Start project - CustomAssembly for more details.

thank you for your reply!
No search area was added before. After adding, the compilation is OK, but scriptRun.Run() reports an error, as follows: “Failed to load the file or assembly “TestDll, Version=, Culture=neutral, PublicKeyToken= null” or one of its dependencies. Find The file specified by the system is not found.”
I modified the program environment and DLL to X64, unified to .net 4.6.1, and reported the same error!
The same error when referencing TestDll.dll in Custom assembly Demo。

It may be the reason why I am not familiar with AlterNET, please help me, thank you!

Add TestDll Code,this is Demo!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace TestDll
public class MessageInfo
public MessageInfo()

    public void ShowInfo(string s)



Could you please send me your demo so I can investigate the problem?

Link attached!


Hi,I found the problem because I dispose the script object! Too embarrassing!

Great, thank you for confirming.