This project has moved and is read-only. For the latest updates, please go here.

Visual Studio 2013 cannot load assembly Microsoft.ClearScript.Windows.VBScriptEngine

Oct 20, 2014 at 10:56 PM
Edited Oct 20, 2014 at 11:00 PM
Hello, I can't find any help for this error. I installed ClearScript from the NuGet Package Manager console using Install-Package ClearScript. I see messages informing me 'ClearScript' installed successfully.

I then tried to create a simple test project that instantiated the VBScriptEngine object using the following:
    public class ClearScriptEngine
       private readonly VBScriptEngine _engine;

       public ClearScriptEngine()
          _engine = new VBScriptEngine();
When running, I receive this exception:
"Could not load type 'Microsoft.ClearScript.Windows.VBScriptEngine' from assembly 'ClearScript, Version=, Culture=neutral, PublicKeyToken=null'.":"Microsoft.ClearScript.Windows.VBScriptEngine"

Anyone know how to fix this? Is there a setting I'm missing? Again, the only setup I performed was installing from NuGet Package Manager.

I'm running Visual Studio Premium 2013. Version 12.0.30723.00 Update 3. .NET Framework Version 4.5.51641.
Oct 21, 2014 at 12:30 PM
Edited Oct 21, 2014 at 1:40 PM

It looks like you're using this NuGet package. Generally, as we don't release ClearScript binaries, we recommend that NuGet package issues be reported to the package owners.

That said, we did run a quick test with this package, adding it to a command-line test application and successfully executing a few lines of VBScript code.

Can you provide any more details about the exception you're seeing? If you can share your test project, or the relevant portions of it, that could be very helpful as well.

Oct 21, 2014 at 3:31 PM
Edited Oct 21, 2014 at 3:42 PM
Thanks for the quick reply!

I decided to delete everything and then use the zip download from here to build my ClearScript assembly using the Non-V8 solution. I'm still receiving the same exception:

{"Could not load type 'Microsoft.ClearScript.Windows.VBScriptEngine' from assembly 'ClearScript, Version=, Culture=neutral, PublicKeyToken=null'.":"Microsoft.ClearScript.Windows.VBScriptEngine"}

The issue occurs as soon as I try to instantiate my object wrapping the VBScriptEngine.

Here is a link to a zip file of my test solution. The solution is pretty straight forward. Two projects, one is a class assembly to wrap ClearScript interaction, the other is a XAML project. The class assembly has one class in it called ClearScriptEngine. When the XAML project tries to instantiate the ClearScriptEngine class, the exception above is thrown and XAML wraps it with a XAML parse exception.

ClearScript Test Solution

Oct 21, 2014 at 4:09 PM
Hi again!

Thanks for sharing your solution.

The problem seems to be that your solution includes a class library project that generates "ClearScript.dll", which conflicts with the ClearScript assembly of the same name in the output directory.

Try changing the name of your assembly:
  1. Right-click your class library project and select "Properties".
  2. Change the assembly name from "ClearScript" to "ClearScriptLibrary" or something like that.
  3. Click "File" -> "Save All"
  4. Rebuild your solution.
Good luck!
Oct 21, 2014 at 5:19 PM
Edited Oct 21, 2014 at 5:22 PM
I am so sorry to waste your time. That is such a rookie mistake, I almost feel shame :). It would help if .NET gave a more descript error. Sometimes you just need that extra perspective.
Oct 21, 2014 at 7:46 PM
No worries! Actually, we really should adopt the common convention of using the base namespace name for the assembly name; e.g., "Microsoft.ClearScript.dll". That would have prevented your issue as well. Thanks again!