Reputation: 2661
I am trying to execute a script written in VBScript
, in a C#
class library project
using System.Web.UI; //reference added at top
MSScriptControl script = new ScriptControl();
script.Language = "VBScript";
script.AddObject("Repository", connectToDB.GetRepository);
I get the following compilation error:
Error CS0246: The type or namespace name 'MSScriptControl' could not be found (are you missing a using directive or an assembly reference?)
Any ideas?
Upvotes: 2
Views: 4608
Reputation: 7193
using Microsoft.VisualBasic;
Use this code:
MSScriptControl.ScriptControl script = new MSScriptControl.ScriptControl();
script.Language = "VBScript";
script.AddObject("Repository", connectToDB.GetRepository);
Upvotes: 1
Reputation: 5272
I belive
MSScriptControl script = new ScriptControl();
should be
MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControl();
Upvotes: 1