Using a .dll with a script

bradbradbrad wrote on 11/2/2016, 8:30 AM

Good morning/afternoon,

I'm trying to get a script to run that calls a function found in a .dll that I have created.  I have placed the compiled .dll file in the Sony Vegas Script Menu, rescanned the menu, etc etc and tried to run the script with no luck.  I can successfully create/run scripts without using a .dll, but I would like to be able to create a libarary containing functions for my scripts to call. 

From what I can gather, the proper way to set up a script that uses a .dll is like this:

1.) Create your library and c# script that uses functions in the library.  Build this file and add the newly compiled .dll to the Vegas Script menu.

2.) Create a secondary script that will actually be ran from the script menu in sony vegas.  This script uses the dll created in step 1.

My problem arises when I try to run the scrip in step 2.  I get an error saying that the namespace of the .dll I created could not be found, even though it is available in the script menu and included in the script I am running.  I also get an error saying that the class I inherited in my script, which is defined in the .dll file, coulld not be found as well.

My .dll file looks like this:


using ScriptPortal.Vegas;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Windows.Forms;

namespace vegasDLLTest 

    public abstract class SharedEntryPoint
        Vegas myVegas;

        public virtual void FromVegas(Vegas vegas)
            myVegas = vegas;

        public void showMessage()
            MessageBox.Show("message from DLL");


My script that uses the funciton showMessage found in the .dll looks like this:

using ScriptPortal.Vegas;
using vegasDLLTest;
using System;
using System.Windows.Forms;
using System.IO;

public class EntryPoint : SharedEntryPoint
    public override void FromVegas(Vegas myVegas)



        catch (Exception ex)

If you read all this, thanks for sticking through it.  If you can help, well, here's a bigger THANKS.  This is driving me crazy.


Gary James wrote on 11/2/2016, 9:01 AM

If your script is a compiled DLL you should have no problem.  You link to the DLL as you would when setting up any other project in Visual Studio.   If your script is a text file then what you're trying to do is called Late Binding.    See this example code in Code Project.  It shows how to late bind to a dll without any previous linking.


bradbradbrad wrote on 11/2/2016, 9:05 AM

Late binding doesn't seem to be the issue.  I've compiled the DLL and there are no erros when I build the file.  Once I call the script in Vegas is when the erros appear saying that it can't find namespaces defined in the DLL. 

VEGASNeal1 wrote on 11/8/2016, 4:41 PM

I had no trouble running your example ... with these adjustments:

1. Ensure the project properties for the DLL project are set with Application, Target Framework, as ".NET Framework 4"; and Build, Platform target, as "x64"

2. For the script that uses the DLL, create the companion XML ".config" describing the location of vegasDLLTest.dll.

bradbradbrad wrote on 11/9/2016, 8:04 AM

Thanks gret, i'll give that a shot.  I'm familiar with XML, but this is the first time I've heard about having to make a config to run a script.  I'm guessing that since I'm running functions found in a DLL that the vegas script doesn't know where the DLL exists unless I explicitly tell it where?

bradbradbrad wrote on 11/9/2016, 9:49 AM

Ok, gret was completely correct.  I did not have an XML config file setup to let Vegas know hey, you can use this .dll.

So, to get it running, I created an XML file that looks like this:

  <AssemblyReference resolver="local">nameOfYourDLL.dll</AssemblyReference>

My .dll contains the vegas script that I wish to run and the library with the function that will be called from my script.  Then, I have a standalone script that looks exactly like the script that is in the .dll that is actually called/run in Vegas.  

I'm not sure if my .dll has to include a copy of the script to be run, but as I have it setup now, everything runs fine. 

Again, thanks for everyone's input, especially yours gret!


Jason-Stoll wrote on 6/3/2020, 6:09 PM


New reply to old post. Very helpful, thanks :-) But what is the name of the xml file you added?