ScriptStash.Net 2.0.0

Install-Package ScriptStash.Net -Version 2.0.0
dotnet add package ScriptStash.Net --version 2.0.0
<PackageReference Include="ScriptStash.Net" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ScriptStash.Net --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ScriptStash.Net, 2.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ScriptStash.Net as a Cake Addin
#addin nuget:?package=ScriptStash.Net&version=2.0.0

// Install ScriptStash.Net as a Cake Tool
#tool nuget:?package=ScriptStash.Net&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ScriptStash ScriptStash Logo


What is ...

ScriptStash is a C# code loader for text/script files manipulation. It loads each script file once. Keeping it stored in-memory, ready to be used for any applicative reuse over and over. Also, it can be used for token-driven scripting (e.g. place in script token for SELECT-SQL table name, changing the query target table dynamically at run-time).

How it works ...

ScriptStash loads with System.IO.File each script at its destination folder and store it in-memory while your solution application running. ScriptStash can store dictionary key-value pairs for token injection to every stored tokenized script file. So, it can return the original file loaded, or a transformed text with all needed tokens replaced with values from given dictionary.

Usage ...

Usage examples:

  • Maintain a query SQL scripts directory for a web-application with database storage.
  • Keep reusable shell scripts for 3rd party ALM tool. Load and execute them from yours C# application utility.
  • Store scripts from any scripting language (e.g. PowerShell, VBScript, JavaScript, etc.) for execution from C# app.
  • Handle installation scripts batch, to be deployed on several environments with different inner setting per environment.
  • Maintain test template scripts, with data-driven cases to be injected to each test template before execution.

Code Example ...

  string scriptsFolder = "c:\project\scripts";
  string pattern = "*.sql";
  string genSelectAllQuery = "select_all_query.sql";
  string genTemplateTableQuery = "template_table_query.sql";
  ScriptStash mySqlStash = new ScriptStash(scriptsFolder, pattern);
  string sqlText1 = myStash[genSelectAllQueryName].Text;
  myStash.Tokens["<table-name>"] = "USERS";
  myStash.Tokens["<where-clause>"] = "WHERE USER.City='Tel-Aviv";
  string sqlText2 = myStash[genTemplateTableQuery].InjectTokens();

[!] For more indepth example please chek next Gist : Stash example - SQL queries


Check out ScriptStash documentation pages here.


This project is MIT licensed. For more information, see license.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 81 11/13/2021
1.0.1 443 11/11/2018
1.0.0 635 11/10/2018

Major release with 1st time dotnet multi frameworks support.