Skip to content

Instantly share code, notes, and snippets.

@stirno
Last active December 28, 2015 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stirno/7492082 to your computer and use it in GitHub Desktop.
Save stirno/7492082 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8" ?>
<packages>
<package id="FluentAutomation.SeleniumWebDriver" version="2.2.0.1" targetFramework="net40" />
<package id="ScriptCs.Contracts" version="0.8.1.0" targetFramework="net45" />
<package id="ScriptCs.FluentAutomation" version="1.0.3.3" targetFramework="net45" />
</packages>
var execPath = this.CreateExecutionDirectory();
var scriptName = Guid.NewGuid().ToString() + ".csx";
var console = new ScriptConsole();
var builder = new ScriptServicesBuilder(console, new Common.Logging.Simple.TraceLogger(false, "ScriptCs", Common.Logging.LogLevel.All, true, true, false, "hh:mm:ss"));
builder.ScriptName(scriptName).InMemory(true);
var services = builder.Build();
var packages = services.PackageAssemblyResolver.GetPackages(execPath);
services.InstallationProvider.Initialize();
services.PackageInstaller.InstallPackages(packages);
var assemblyPaths = services.AssemblyResolver.GetAssemblyPaths(execPath, scriptName);
var scriptPacks = services.ScriptPackResolver.GetPacks();
services.Executor.Initialize(assemblyPaths, scriptPacks);
var result = services.Executor.ExecuteScript("var Test = Require<F14N>();");
services.Executor.Terminate();
services.Console.Exit();
@stirno
Copy link
Author

stirno commented Nov 15, 2013

this.CreateExecutionDirectory() drops a packages.config file in a new temp dir that includes required nuget packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment