SBE-Scripts

SBE-Scripts - it is our engine for additional work over MSBuild - conditions, subcommands, file operations, etc. by components.

you can use this as an additional variant and/or if need a some features, for example, special for Visual Studio etc. all of that are not exists/available with MSBuild

Components

BoxComponent Container of data for operations like a template, repeating, etc.
BuildComponent Managing of build process at runtime. And similar operations for projects and solution.
CommentComponent The comments for scripts.
ConditionComponent Conditional statements for scripts.
DTEComponent For work with EnvDTE.
FileComponent I/O File operations.
FunctionComponent Mixed supported functions.
InternalComponent All internal operations with vsSBE.
MSBuildComponent Advanced evaluation with MSBuild engine.
NuGetComponent Support of NuGet packages.
OWPComponent Works with OWP and similar operations.
SevenZipComponent 7-Zip File archiver with high compression ratio.
TryComponent Protects from errors in try{...} block and handles it in catch{...}
UserVariableComponent Support of dynamic variables via User-Variables core.

Syntax

All commands and operations should be wrapped with container:

#[ ... ]

To escape an sequences use #:

##[ ... ]

Sample

Try execute this:

#["
    Basic example
"]
#[var v = 1.2.3]
#[var log = $(TMP)/v.txt]

#[($(Configuration) ~= Deb || true)
{
    #[var tBase     = $([System.DateTime]::Parse('2015/10/01').ToBinary())]
    #[var tNow      = $([System.DateTime]::UtcNow.Ticks)]
    #[var revBuild  = #[$(
                        [System.TimeSpan]::FromTicks('$(
                            [MSBuild]::Subtract(
                            $(tNow), 
                            $(tBase))
                        )')
                        .TotalMinutes
                        .ToString('0'))]]
    
    #[var v = $(v).$([MSBuild]::Modulo($(revBuild), $([System.Math]::Pow(2, 14))))]
}]

#[var v = $([System.String]::Format("v{0}\r\n\t", $(v)))]
#[File write("#[var log]"):> Example #[var v] Generated by vsSolutionBuildEvent]
#[IO scall("notepad", "#[var log]")]

$(n = $([System.Math]::Exp('$([MSBuild]::Multiply($([System.Math]::Log(2)), 16))')))
$(n)

If you have some problems with syntax and documentation can't say how it should be… don't worry, just create new Issue - we'll help you.

Arguments

Information for this section is not complete or temporarily is not available. To fix it, click - Edit
type description
integer Signed 32-bit integer
string From double quotes & From single quotes
char  
float Signed floating-point number with single-precision. The f postfix for clarify: 1.25f, -1.25f
double Signed floating-point number with double-precision. The optional d postfix for clarify: 1.25d or simply 1.25, -1.25
enum  
const  
expression The composite definition, like a conditional expression ~ (((1 < 2) && true) || $(debug) != "r200") etc.

Object type

The object type is new type for work with complex mixed data. Initially it was implemented special for vsCommandEvent.

The vsSBE users should see this starting with v0.12.5+

Value can be from all available scalar types + complex, like this:

{}
{"str", true}
{"str", {1, 'y', {-12.457f}}, true}

etc.

Boolean type

Allowed forms:

true false
1 0
True False
TRUE FALSE
true false

In (Input) type

This is the unspecified or mixed data. Used as defined and the engine will consider it 'as is':

  • May contain any count of newline symbols.
  • As and for string arguments may contain other inner sbe-scripts containers that will be evaluated before.

It's also safe for pair symbols of container ([, ]). For unpaired it will be corrupt. Therefore, you should place your data inside quote symbols as a string argument above or use special marker (v0.12.6+):

<#data> ... </#data>

Dom & Code Completion

With latest versions we use Dom for inspecting model of SBE-Scripts core. You can see all available features with code completion (Intellisense) in editor.

Work from other Modes

The all available modes should provide support of this engine. Moreover, in C# Mode you can also use engine directly as you want! But first read this.

New Components for SBE-Scripts core

References