vsSolutionBuildEvent API

vsSolutionBuildEvent API vsSolutionBuildEvent provides API layer for external tools and their various environments to access for events/actions and more. For example, this is already used in the following products: CI.MSBuild - for work through msbuild.exe (Microsoft Build Tools) Devenv Command-Line - for work through devenv of the Visual Studio Where to begin Scheme of vsSolutionBuildEvent projects: 1.14.1+ Please note: Provider now distributed together with Bridge as part of the API layer. Specified interfaces to communicate with vsSolutionBuildEvent: Bridge/ Download vsSBE.API.1.4+014f49a.SDK15.zip Download Before 1.14.1 Bridge Current module sp ...

Continuous Integration

Continuous Integration (CI) vsSolutionBuildEvent supports CI features [?] and may work without Visual Studio at all. CI.MSBuild support for MSBuild Tools. Legacy Devenv Command-Line support for devenv Visual Studio instance. Other via API. It is easy to support any other tools and environments. Start with Developer Zone. GUI You can easily control scripts beyond of the Visual Studio IDE. Read more in Native scripting. after.<name>.sln.targets You can simply use this feature if you only need a unified action in both MSBuild + Visual Studio environments for all projects at once etc. Read here ...

vsSolutionBuildEvent CI.MSBuild

Modern versions are considered now as part of the main project for CI support vsSolutionBuildEvent CI.MSBuild Module for work with vsSolutionBuildEvent through Microsoft Build Tools How to get & Install Use get-vsSBE.1.14.1.bat (~10 Kb) to get it in one click. (Compiled by GetNuTool) How to configure project that does not use Visual Studio at all. NuGet packages Modern versions: Legacy versions: You can easily get package using lightweight script tool GetNuTool ~10 Kb gnt /p:ngpackages="vsSolutionBuildEvent/1.14.1" msbuild gnt.core /p:ngpackages="vsSolutionBuildEvent/1.14.1" How to use Basic activation through cim.cmd helper (di ...

vsSolutionBuildEvent Devenv Command-Line

vsSolutionBuildEvent Devenv Module to support the Devenv Command-Line of the Visual Studio. Please note: you can also use CI.MSBuild module for work through MSBuild tools. Add-ins are deprecated in Visual Studio 2013 and was removed in 14CTP's (VS 2015) Devenv Command-Line only supports the following: Visual Studio 2010, 2012, 2013. Features are not available for VSPackages that was possible only because of our tricks. Please consider upgrading to modern CI.MSBuild How to get & Install Download Devenv.1.3+014f49a.SDK10.zip Archive binaries: /CI-Utilities/Devenv/ Currently the Devenv module distributed only as an additional wrapper (~41 kb) ...

Developer Zone

Developer Zone How to build New Component for SBE-Scripts core IPM analyzer Dom & Code Completion API Scheme of vsSolutionBuildEvent projects Ask a question ...

Create component for SBE-Scripts in 5min.

Create component for SBE-Scripts core in 5min. For a quick lexical analysis of properties and methods, you can use our IPM analyzer - It allows to quickly prepare for semantic analysis all of what you want… All components should implement the IComponent interface. Also available abstract Component for rapid implementation of all new features. The Component is already contains basic behaviours with available data. Therefore, create the new component is really easy. DemoComponent Let's try to create new 'DemoComponent' step by step. All components should have postfix Component as part of name, for example: MathComponent Add new class in path /SBEScripts/Components/DemoComponent.cs ...

Developer zone. SBE-Scripts

Developer zone. SBE-Scripts Dom and Code Completion IPM analyzer for SBE-Scripts core ...

Dom and Code Completion

Dom & Code Completion Optional, you can describe your component with SBEScripts/Dom for code completion (Intellisense) or to any generation of documentation. It's easy with next attributes: PropertyAttribute To describe the properties of the component. For example: [Property("propertyName", "Description of the property", CValueType.Boolean, CValueType.Boolean)] protected string yourLogic() { ... } [Property( "IsBuildable", "Gets or Sets whether the project or project item configuration can be built.", "find", "stProjectConf", CValueType.Boolean, CValueType.Boolean )] Syntax: [Property(string name, string description, CValueType get, CValueType se ...

IPM analyzer for SBE-Scripts core

IPM analyzer With latest changes you can also use our IPM analyzer for parsing of any properties & methods. It useful for a quick implementation of any logic for new or existing component. Overview All magic of this starts with: IPM pm = new PM(data) Where data it's your raw data 'as is'. Then, you can work with parsed data via pm instance. How about calculating the hash value with MD5 & SHA-1 ? and possible syntax like this: #[Func hash.MD5("test")] #[Func hash.SHA1("test")] ok, here's how to (all minimal logic): IPM pm = new PM(data); // pointed to - ILevel lvlHash // hash.MD5("data") if(pm.FinalEmptyIs(LevelType.Method, "MD5")) { lvlHash.Is("hash.MD5(string data) ...

Available Events

Available Events Pre-Build - Before build. Post-Build - After build. Cancel-Build - by user or when occurs error. CommandEvent (DTE) - The Command Events from EnvDTE. Warnings-Build - Warnings during assembly processing. Errors-Build - Errors during assembly processing. Output-Build - Customization and full control by using listener. Sln-Opened - When solution has been opened. Sln-Closed - When solution has been closed. Transmitter - Transmission of the build-data to outer handler. Logging - All processes with internal logging. Information for this section is not complete or temporarily is not available. To fix it, click - ...

CommandEvent. EnvDTE

CommandEvent (DTE) This can be used for catching of the command events from your VS IDE. For advanced work with all commands beyond of the solution level, use the vsCommandEvent Also available Sniffer as helper for listening all commands from EnvDTE: Find and add all what you want, configure it after, then use with available modes. Get the last command You can use DTEComponent of SBE-Scripts core. Samples: $(lcGuid = #[DTE events.LastCommand.Guid]) $(lcId = #[DTE events.LastCommand.Id]) #[($(lcGuid) == "{1496A755-94DE-11D0-8C3F-00C04FC2AAE2}" && $(lcId) == 1627) { #[File scall("notepad", "#[var log]", 30)] }] or you can use C# Mode etc. References ...

Pre-Build

Pre-Build event It will be triggered when the build is started. Solution-context By default, your actions should be activated before first project at once. To be precise, it works before any build of your projects (solution-context). You should note this if you want to work with cancel command and similar. (the cancel can be executed only when the build is started at least for one [?]) Projects-context also known as Deferred Pre-Build To switch to current context you can use any from the following below. Execution order Execution order list: Select one or more available projects from this list. 'OR logic' between all records: if you select 2 or more project in list, t ...

Sln-Opened

Sln-Opened v0.12.7+ It will be triggered when solution has been opened. This especially useful for definition of new properties at runtime for your solution (to solve problems like this). For the same or similar case it can be is really easy for this event type: Add action for Sln-Opened event. Enable MSBuild support. Define what you need: $(+ProjectName = 'MyUnifiedName') Activate event and click [Apply] Enjoy. Context [ v0.12.8+ ] The new version provides additional contexts of Sln-Opened events. What does it mean ? Working in Visual Studio IDE you may have the following cases: When you need to do something Before initializing projects, for example: ...

Examples

Feel free to improve our wiki. Click Edit button below or start new page. Complete solutions Automatic Version Numbering Manually Wizard - Automatic code generation Simple variant Artefacts. How to prepare as you want Stop build on first error Demo projects Reload projects in solution Advanced work with Git submodules Native scripting. World without Visual Studio Some features Math operations Date & Time .vssbe File format & Unified Project name for different .sln Actions for specific configuration Solution-wide Build Events Confirmation dialog Work with Unit-Tests & EnvDTE Exclude projects from build on Pre-Buil ...

Artefacts. How to prepare as you want

Artefacts. How to prepare as you want About different Environments Firstly, it doesn't matter where the planned use this script. It can be unified for all environments. It means you should see the same result as for your PC with Visual Studio (for example) and same for X Build Server (CI): Read first: How to work with CI components. .vssbe for each .sln Releases from a few projects Full example you can see in our project: Full script for assembling the vsSolutionBuildEvent v0.12.6 (actual version in current script file) As result you will see this files (i.e. only for example - your variants can be as you want) for deploy or for simple use. Sample: File ...

Demo projects

List of available demo projects as example of basic work, features and similar. Real projects Some features and scripts you can see on the following latest real projects: https://github.com/3F/Conari https://github.com/3F/LunaRoad https://github.com/3F/DllExport CI.MSBuild.Demo For work with MSBuild Tool or for work without Visual Studio you have a few ways. And if your choice the CI.MSBuild you also should select how it will be automatically distributed on another machines (where some of this utilities may not exist at all). The most easy variant it is the non-binary GetNuTool ~8kb. However, you can also use standard NuGet clients and any other tools. In samples below we'll c ...

Stop build on first error

Stop build on first error Immediately stop(at the same time) after the first appearance. For example, If you also used StopOnFirstBuildError before, you can see - that it not resolves important problem for big projects or/and for slow machines… A quick example what it means: If your each project in your solution requires a long time for full compilation (~5-10min average for example)… Well, congratulation.. you still should wait the end of building project where error occurred(~5-10min average for example). Why ? and Why is not exists any settings for this ? we don't know but this is so because the StopOnFirstBuildError used subscription with OnBuildProjConfigDone. However th ...

Git Solutions

Git Solutions Advanced work with Git submodules ...

Advanced work with Git submodules

Advanced work with Git submodules Restore all git submodules when opening Visual Studio IDE Before v0.12.8 you have this way. But now it can be much easier. Add Action for Sln-Opened event. Set Context: Before Select Script Mode Then add simple script, for example, we want to restore Conari: #[( !(#[IO exists.file("$(pConari)/Conari.sln")]) ) { #[File call("git", "submodule update --init Conari", 1000)] }] Additionally you can restore and prepare .NET Core projects and/or some related nuget packages (including legacy packages.config), for example: #[( !(#[IO exists.file("packages/__checked")]) ) { #[File call("hmsbuild.bat", "-t:restore /v:q /nologo /p:Configuration=$ ...

Native scripting. World without Visual Studio

Native scripting World without Visual Studio. You can easily control scripts beyond of the Visual Studio IDE. Moreover this may be the only way for projects like hMSBuild or GetNuTool and so on. Modern versions 1.14.1+ Just command this: gnt /p:ngpackages="vsSolutionBuildEvent/1.14.1" [ ? ] Or run helper get-vsSBE.1.14.1.bat Then call from working dir: packages\vsSolutionBuildEvent.1.14.1\GUI.bat After, create ~ build.bat for restoring and activation if no VS IDE. To activate Events and Actions, for example: call packages\vsSolutionBuildEvent.1.14.1\cim.cmd /v:m /m:4 Or use available bootstrap from projects such as Conari, and so on. That's all. Script what you li ...

Reload projects in solution

Reload projects in solution In some cases you may need automatically reload your projects in solution. For example, you have added git submodules for your projects, and you want to update/get it automatically after cloning of your repo when .sln is opened in first time. Starting with v0.12.8 you have also the Contexts for Sln-Opened event. Modern way to Restore all git submodules when opening Visual Studio IDE How to Select event type, for example the Sln-Opened to reload projects when you open Visual Studio with your Solution. Then, add action with C# Mode Now you can write code, for example: https://gist.github.com/3F/a7f8eeb59ade9139d4da4862e03ee ...

Automatic Version Numbering - Variants

Automatic Version Numbering [ View ] Wizard Automatic code generation [ View ] Simple variant The easiest manual way. [ View ] ...

Automatic Version Numbering

Automatic Version Numbering You can also use the Wizard. Easy steps for quick results. The easiest manual way here. Before reading, please note: You can achieve this (or similar) result with our different modes. For simplicity, we'll consider Script Mode. But you can also try with Targets Mode or C# Mode, or even with simple caller and others. Synopsis This method will generate automatically the Version class like this ↘ public struct EvMSBuildVersion { public static readonly Version number = new Version(S_NUM_REV); public const string S_NUM = "1.14.1"; public const string S_REV = "0"; public const string S_NUM_REV = S_NUM + "." + S_REV ...

Simple Version Numbering

Simple Version Numbering The most easy versioning for your projects can be lighter than it described in 'Manually' page. And if you still want to configure this manually instead of a Wizard, let's talk about simple but still powerful way. Real projects First of all, you can look the real projects in action. It is actively used for the following projects: regXwild Sample of build 7z.Libs MvsSln Conari DllExport hMSBuild LuNari GetNuTool vsSolutionBuildEvent … How to In 'Manually' page we create a template of 'Version' file, then generate all of what we need. But here we'll create a 'normal Version file' (file that's already stored with other ...

Wizard - Automatic Version Numbering

Wizard - Automatic Version Numbering Automatic code generation The current code generation wizard is available for v0.12.5+ How to Open wizard from Settings - Wizards - Automatic Version Numbering and choose type of generation. What available: C# Struct C++ Struct C++ macro definitions ( #define ) Direct replacement Configure all required fields for each steps and move to final by pressing Next step ... After the all required steps for selected type you will see final script for SBE-Scripts engine: That's all. The final complex script should be evaluated with our engine, so simply add new action and smile :) You can create new action immediatly from this by clicki ...

Features

Some features Actions for specific configuration Confirmation dialog / Prompt window Custom counters Date and Time ...

Actions for specific configuration

Actions for specific configuration For v0.9+ You can use an additional option "Actions for specific configurations" (see below) or conditional statements with SBE-Scripts core. Turn on support: SBE-Scripts & MSBuild in control window. And use for example: #[( $(Configuration) == "Debug" ){ ... }] also you can check only part of the name, e.g.: #[($(Configuration) ~= "_with_revision") { All configuration with names: * Debug_with_revision, * Release_with_revision, etc. }] and similar. /See ConditionComponent for more details For v0.8+ Actions for specific configurations has been introduced in v0.8 Simply: Select the event type, mode, add the a ...

Confirmation dialog / Prompt window

Confirmation dialog / Prompt window In latest versions you can use special option for your scripts. Simply add any action type for any events In Control section set the Confirmation option. This can be useful for most operations. However you can also use own dialogs, see below. Custom dialogs You can use any own dialog if needed, for example: Activate SBE-Scripts support Use script for example: #[(#[File sout("cscript", "//nologo dialog.vbs")]) { ... your action if 'Yes' }] Where dialog.vbs it's a simple vbscript with msgbox, for example: ' Sample of dialog ret = MsgBox("... information ...", vbAbortRetryIgnore + vbDefaultButton3 + vbExclamation , "Custom d ...

Custom counters

Custom counters Should be enabled the MSBuild & SBE-Scripts. Increment & Decrement Numbers Syntactic sugar of v0.12.8+ v0.12.8+ Contains syntactic sugar: += & -= #[Box iterate(i = 0; $(i) < 10; i += 1): ... $(numA += 3.14) $(numB -= 1) ] other Very old examples: Read Math page + please fix me Information for this section is not complete or temporarily is not available. To fix it, click - Edit Example of counter in the range 1 - 10: #[( $(counter) == "*Undefined*" ) { #[var counter = 0] }] $(counter = $([MSBuild]::Add($(counter), 1))) #[" The var ...

Date and Time

Date & Time Should be enabled the MSBuild support. In examples below, we use the MSBuild Property Functions and you can use any static method or property of these system classes: System.DateTime System.TimeSpan System.Math System.String System.Decimal System.Double System.UInt32 System.Int32 … Format & Culture Custom Date and Time Format Strings Standard Date and Time Format Strings Sortable format: ~ yyyy/MM/dd, e.g.: 2016/08/21 for InvariantCulture For specific culture, use for example: $([System.DateTime]::Parse("21.08.2016", '$([System.Globalization.CultureInfo]::GetCultureInfo("ru-RU"))')) $([System.DateTime]::Parse("08/21/2016", '$([System.Gl ...

Work with Unit-Tests and EnvDTE

Work with Unit-Tests & EnvDTE This especially useful for old Visual Studio 2010 where are not exists simple settings to run tests after the build of your application etc. Please remember: newest versions >= VS2012 contains settings for this. See How to. What's exist for VS2010: MSDN: Configure and Run Scheduled Tests After Building Your Application MSDN: Run Automated Tests from the Command Line Using MSTest vsSBE provides flexible actions and also may work with EnvDTE environment. So you can simply run all tests after build, e.g.: Use Operation Mode for your action. Select the operation - "Run all Unit-Tests" or "Debug all Unit-Tests". Optional set specific configu ...

Exclude projects from build on Pre-Build event

Exclude projects from build on Pre-Build event It appeared after request from Q/A (related issue) So if you want activate or deactivate any projects when build is started… well it's possible with vsSolutionBuildEvent How ? This feature is part of SBE-Scripts (controlled by BuildComponent). Therefore you should activate support of this engine. Ok, it's simply… You should use IsBuildable property for get/set value of selected project(s). #[Build projects.find("name").IsBuildable = true|false|1|0] #[Build projects.find("name").IsBuildable] Where name is project name in your solution, for example: "bzip2.vcxproj" "Zenlib\ZenLib.vcxproj" etc. Examples Set true value if nex ...

Work with external utilities

Work with external utilities Basic work All simple modes like Files Mode, Interpreter Mode can be used for work with any external utilities. You can call what you want and easy get result from the output (STDOUT, STDERR). For example (old samples): get changes between revisions update revision with data from SCM - git parsing of .html files and generating cshelp.h with C++ macro definitions However! you can much more. see below Advanced work A complex work with data from any external tools and features that are not available for MSBuild: Select suitable mode: Processing modes Try to use existing component of SBE-Scripts engine like: FileComponent - IO operations, i ...

Math operations

Math operations Remarks Numbers in scientific (exponential) notation For example - Double.Parse(): $([System.Double]::Parse('1,19E+7')) $([System.Double]::Parse('1.19E+7')) - Fail: The expression "[System.Double]::Parse(1.19E+7)" cannot be evaluated. Input string was not in a correct format. To avoid error above (for your selected culture) you can use, for example: $([System.Double]::Parse('1.19E+7', '$([System.Globalization.CultureInfo]::GetCultureInfo("en-US"))')) $([System.Double]::Parse('1.19E+7', '$([System.Globalization.CultureInfo]::CurrentUICulture)')) $([System.Double]::Parse('1.19E+7', '$([System.Globalization.CultureInfo]::CurrentUICulture.NumberFormat)')) $([System.Double] ...

Remote servers

Remote servers For work with remote servers you can use any available variants from available modes v0.12.6+ is already contains features for work with remote servers. Use FileComponent FTP - C# Mode Upload Artefacts and similar Activate C# Mode Add 'System.dll' reference in Compiler - References Customize cache and check other available flags of optimization. (optional) Use next code, for example: using System; using System.Net; using ICommand = net.r_eg.vsSBE.Actions.ICommand; using ISolutionEvent = net.r_eg.vsSBE.Events.ISolutionEvent; namespace vsSolutionBuildEvent { public class CSharpMode { public static int ...

Solution-wide Build Events

Solution-wide Build Events All your actions for Pre-Build / Post-Build events are already can be for all projects at once or individually for each. (You should remember this for work with MSBuild engine etc.) It should be useful for most cases, for example: Automatic Version Numbering for your projects. Or simple notification like ~ send email before/after building of all projects: mail('[email protected]', 'Build completed', date('H:i:s')); and other. Use it with simple caller (external logic) or as internal scripts with any interpreters such as php, python, PowerShell, Wscript, Node.js, etc. Or use powerfull MSBuild & SBE-Scripts engines, etc. For more complex script ...

Operations with strings

Operations with strings Did you know: v0.12.10+ has multiline support for MSBuild expressions via MSBuildComponent: #[$( [System.TimeSpan]::FromTicks('$( [MSBuild]::Subtract( $(tNow), $(tBase)) )') .TotalMinutes .ToString('0'))] Concatenation v0.12.8+ Contains syntactic sugar +=: $(desc = "Hello ") $(desc += "world !") or you can use: $(desc = "Hello ") $(desc = $([System.String]::Concat($(desc), "world !")) ) Remove newline characters and other problematic symbols Some your results may contain a some problematic characters for different functions. In most cases this applies to MSBuild Property Functions. You can use System.String static ...

Tricks with strings

Tricks with strings Some additional custom tricks of common operations with strings -> Operations with strings v0.12.6+ Allows evaluation of string arguments with MSBuild engine in File/Function/BuildComponent + some newer. You can also use the MSBuildComponent to force evaluation if still needed. Did you know: v0.12.10+ has multiline support for MSBuild expressions via MSBuildComponent: #[$( [System.Math]::Exp('$( [MSBuild]::Multiply( $([System.Math]::Log(10)), 4 ))' ) )] Did you know: The UserVariableComponent allows the multiline mixed definition: #[var arg = cd \"D:/tmp/\" dir cd .. dir] #[var arg = $(arg.Replace( ...

.vssbe File

.vssbe All shared settings will be located in solution directory as .vssbe text-based file. v0.9+ uses the JSON format (text-based language-independent data interchange format) You can also ignore this from your repo with scm if needed (.gitignore, .hgignore, .bzrignore, svn:ignore, etc.,) Samples Simple .vssbe from GetNuTool project: for build, test, and zip-packing of binaries. .vssbe for each .sln (Solution File) For v0.11.2+ you can also define the special version of configuration file for specific solution. <SolutionFile>.vssbe For example: If you have a different solution files: app_2012.sln app_2013.sln etc. you can also define specific configuration like t ...

Installation

Installation and removal VSPackage (VSIX) About .vsix To install: Get latest build vsSolutionBuildEvent.1.14.1+014f49a.SDK15.vsix, click it, then restart VS IDE. That's all. Manually: VSIXInstaller.exe <downloaded_file> To remove: VS IDE - Tools - Extension and Updates ...: Uninstall or Disable Manually: VSIXInstaller.exe /uninstall:94ecd13f-15f3-4f51-9afd-17f0275c6266 CI.MSBuild UsUse the documentation from here Devenv Command-Line Use the documentation from here ...

How to correctly report

How to correctly report Next information will be helpful: Your version and edition of Visual Studio. For example: VS2013 Professional Version 12.0.30501.00 Update 2 The Version of vsSolutionBuildEvent where you see bug or some problem. The other version where problem not exists if you know. Logs: To enable 'Debug Mode' and reproduce problem again. Any dump of crashes - minidumps or simply like this And most importantly: Steps of how to reproduce your problem. + additional information if you think that's necessary to report: projects type (e.g. C#, C++, ..), data, environments, full moon tonight, and another … Remeber: We support the ...

Processing modes

Processing modes C# Mode Files Mode Interpreter Mode ...

C# Mode

C# Mode This action type for work with C# compiler - feel free with all events & actions. Available control of caching bytecode and full access to ICommand & ISolutionEvent (see /Events) Default Entry point using ICommand = net.r_eg.vsSBE.Actions.ICommand; using ISolutionEvent = net.r_eg.vsSBE.Events.ISolutionEvent; namespace vsSolutionBuildEvent { public class CSharpMode { public static int Init(ICommand cmd, ISolutionEvent evt) { return 0; } } } Compiler settings References Additional assembly names that are referenced by the source to compile. You can use any formats below, for example: EnvDTE.dll C:\WINDOWS\assembly\GAC\En ...

Files Mode

Files Mode This is very simple action type for executing any external files 'as is'. After selecting of this mode you should write file name or list of file names (separated by enter key) with arguments if needed. Note: The solution directory is used by default for all your relative paths or simple file names. You can also enable MSBuild & SBE-Scripts engines for customizing of this list in details. Sample: rev.exe -b 1024 c:\tmp\build.bat $(SolutionDir)\clean.bat Options Information for this section is not complete or temporarily is not available. To fix it, click - Edit Time limit How long to wait the exection ...

Interpreter Mode

Interpreter Mode This is very simple action type for work with external streaming-interpreters (that allowed running code directly as command). For this mode you should configure used interpreter: Name or full path to executable file with arguments for processing your command below. For example: php -r, or cmd.exe /C, etc. treat newline as option: It allows assign any combination of symbols instead of newline from your command below. wrapper: Use this if also requires escaping of the same characters in your command/script. If used 1 symbol, for example - ": Will be escaped all this in your command/script and result should be as " + c ...

Operation Mode

Operation Mode This action type allows executing the DTE-commands for your Visual Studio. After selecting of this mode, you should write command or list of commands (separated by enter key) with arguments if needed. DTE-Commands All available commands for your IDE you can see with UI-Helper: Settings - Tools - DTE-Commands For testing of commands, you can try with testing tool: Settings - Tools - Execution DTE-Commands a few commands should be separated by newline in your list Examples Activation of specific configuration & platform Build.SolutionConfigurations(Debug) Build.SolutionPlatforms(x86) To cancel build operation Build.Cancel Multiple mixed DTE-Commands f ...

Script Mode

Script Mode This action type provides the internal support of scripts from available engines like MSBuild, etc. You can also use other modes for work with any external engines if needed. What's available now ? SBE-Scripts MSBuild References Processing modes Examples & Features Date & Time Operations with strings Automatic Version Numbering ...

Targets Mode

Targets Mode This action type for work with MSBuild Targets / Tasks etc. 'as is' (classic compatible mode). Blank Project v0.12.4+: <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="Init"> <!-- ... --> </Target> <!-- Additional properties: $(ActionName) $(BuildType) $(EventType) $(SupportMSBuild) $(SupportSBEScripts) $(SolutionActiveCfg) $(StartupProject) --> </Project> Obsolete variant: <?xml version="1.0" encoding="utf-8"?& ...

Create new page

Create This Wiki works via GitHub services, so simply click here Then create or select any subpath from _doc/ directory and name your file as you want with .md extension. Just add the following header: --- layout: doc title: <Your title> permalink: /doc/<path>/ --- Where <path> should be to .md file without extension. For example, set /doc/My-Page/ if you will add the My Page.md in root _doc directory. Now you're ready to create your awesome page below from this header. Use markdown syntax or see existing pages. Markdown syntax Test on this page https://guides.github.com/features/mastering-markdown/ Highlighting Use this ( ...

Scheme of vsSolutionBuildEvent projects and their work

Scheme of vsSolutionBuildEvent projects It describes the structure of existing components, illustrates scheme of their work and also shows how it works for Visual Studio Command-Line, MSBuild tools, etc. Basic scheme for v0.12+ Where: vsSolutionBuildEvent The vsSolutionBuildEvent - is the main plugin as a VSPackage. Contains main logic for work with events of Visual Studio via Microsoft.VisualStudio.Shell.Interop. Implements basic model of events with IVsSolutionEvents and IVsUpdateSolutionEvents2 Works with priority processing (i.e. with 'Advise..' methods instead of simple subscription with Events from DTE). See MSDN for more details. Distributed as .vsix for IDE Visual Stud ...

Scripts and Commands

Scripts & Commands The vsSolutionBuildEvent provides advanced actions for all events. User scripts and commands as part of this: SBE-Scripts MSBuild Processing modes - Available modes with C# & MSBuild Targets, etc. References Examples & Features ...

MSBuild

vsSolutionBuildEvent uses E-MSBuild starting from 1.14. Part of the documentation may be irrelevant. Please update me. MSBuild The Microsoft Build Engine which is also known as MSBuild. This page contains information of how to work with MSBuild in vsSolutionBuildEvent context. Additional syntax & basic samples are contained below. For work with MSBuild Tools (Microsoft Build Tools) use the CI.MSBuild. For work with MSBuild Targets, Tasks and others, use the Targets Mode. You can also use the SBE-Scripts engine for additional features as a conditions, subcommands, file operations, etc.   MSBuild Property & Property Functions MSDN - Property Functi ...

SBE-Scripts

vsSolutionBuildEvent uses SobaScript starting from 1.14. Part of the documentation may be irrelevant. Please update me. SBE-Scripts Togehter with E-MSBuild provides powerful conditions, subcommands, I/O operations, and others. Components ...

SBE-Scripts. Available Components

SBE-Scripts. Available Components BoxComponent Container of data for operations like a template, ...

BoxComponent

BoxComponent [ v0.12.8+ ] Container of data for operations like a template, repeating, etc. repeat Executes a block until a specified expression evaluates to false. Available syntax repeat(expression condition [; boolean silent]): mixed data Where: condition - Conditional expression like ((1 < 2) && true) etc. - see examples in ConditionComponent silent - Flag of silent mode. Samples: #[Box repeat($(i) < 10; true): #[File append("test.txt"): #[$(i)] ] $(i = $([MSBuild]::Add($(i), 1))) ] #[Box repeat($(flag)): ... ] iterate Executes a block when condition is true. Available syntax iterate(initializer; condition; iterator): mi ...

BuildComponent

BuildComponent Managing of build process at runtime. And similar operations for projects and solution. Available operations cancel To immediately cancel the build task if it's possible. Syntax: void cancel = boolean Sample: #[Build cancel = true] projects Work with configuration manager of projects through SolutionContexts. find() To find project by name. It compares part of name, therefore you can use simply like a "ZenLib" or full name "Zenlib\ZenLib.vcxproj" etc. Syntax: #[Build projects.find("name")] IsBuildable Gets or Sets. Whether the project or item configuration of project can be built. Associated with current SolutionContext. Syntax: #[Build projects.find("name ...

CommentComponent

CommentComponent The comments for scripts. Tip: the alternative way to fully avoid evaluation from containers of any components - simply remove the first symbol #. Available syntax The multiline comment: #[""] Samples: #[" Example " Description 1 " " Description 2 " "] #[" Example "] #[" To restore packages with GetNuTool It's important for packages of solution-level in VS2015 https://github.com/NuGet/Home/issues/522 TODO: later it can be as part of engine... "] #[($([System.Convert]::ToInt32("$(VisualStudioVersion.Replace('.', ''))")) >= 140) { #[var msbuild = "$(MSBuildToolsPath)\msbuild.exe"] #[IO scall(#[var msbuild], " ...

ConditionComponent

ConditionComponent Conditional statements for scripts. Syntax #[(condition){ body if the condition has true value } else{ body if the condition has false value }] #[(condition){ body if condition has true value }] Available operators ===, !==, ~=, ==, !=, >=, <=, !, >, < v0.11.3+: ^=, =^ Rules of comparison: === Compares as: left == right as string !== Compares as: left != right as string ~= Compares as: left Contains right ? ^= Compares as: left Begins with right ? =^ Compares as: left Ends with right ? == Compares in order of: ...

DTEComponent

DTEComponent For work with EnvDTE (Assembly-wrapped COM library containing the objects and members for Visual Studio core automation. http://msdn.microsoft.com/en-us/library/EnvDTE.aspx) exec Execute the available command. Syntax: #[DTE exec: command(arg)] Sample: #[DTE exec: Build.SolutionPlatforms(x86)] #[DTE exec: Build.SolutionConfigurations(Debug_Exclude_Plugins_All)] #[DTE exec: Build.Cancel] Note: Some commands should be available only for specific context of your environment. For example the Build.Cancel, etc. The raise(guid, id, customIn, customOut) method is available for vsCE users. events Operations with events. LastCommand available with v0.12+ The ...

FileComponent

FileComponent I/O File operations. Remarks Redirection for standard streams for call/scall/sout etc.: All errors can be ~disabled with arguments, for example: stderr to stdout: command 2>&1 stderr to NUL i.e. as disabled: command 2>nul stderr into file: command 2> path_to_file etc. stdout can be a similar: command > destination or command 1> destination Where destination it's similar as above. For more details see: MS Q110930 Support of standard streams STDOUT - Standard output stream. STDERR - Standard error stream. IO alias available with v0.12+ #[IO ...] MSBuild Property Functions. ...

FunctionComponent

FunctionComponent Mixed supported functions. hash v0.12.4+ To work with hash. MD5 Calculate hash value with MD5. Syntax: string #[Func hash.MD5(string data)] Arguments: data - String for calculating. Sample: #[Func hash.MD5("Hello World!")] Result: ED076287532E86365E841E92BFC50D8C SHA1 Calculate hash value with SHA-1. Syntax: string #[Func hash.SHA1(string data)] Arguments: data - String for calculating. Sample: #[Func hash.SHA1("Hello World!")] Result: 2EF7BDE608CE5404E97D5F042F95F89F1C232871 ...

InternalComponent

InternalComponent All internal operations with vsSolutionBuildEvent. Entry point for component The vsSolutionBuildEvent requires the following name for all internal operations: vsSBE or alias Core (v0.12.5+) Samples: #[vsSBE ...] #[Core ...] events Available event types: Pre, Post, Cancel, CommandEvent, Warnings, Errors, OWP, SlnOpened, SlnClosed, Transmitter, Logging Syntax: #[vsSBE events.Type.item(string name)] #[vsSBE events.Type.item(integer index)] Arguments: name - Full name of action. index - Index number of action from list. Range: 1 - n. Sample: #[vsSBE events.Pre.item("Act1")] #[vsSBE events.Pre.item(1)] Enabled Gets or Sets 'Enabled' status for ...

MSBuildComponent

MSBuildComponent Advanced evaluation with MSBuild engine. [ v0.12.6+ ] This is a very simple component (as a mediator) for immediate result from expression via MSBuild. Syntax: #[$(...)] Samples: #[$(name)] #[$([System.String]::Format("v{0}/{1}", $(v), $(r)))] Multiline support [ v0.12.10+ ] Now supports multiline definition of MSBuild data, for example: $([MSBuild]::Add($(revDeltaMin), $([MSBuild]::Modulo($(revBuild), $([MSBuild]::Subtract($(revDeltaMax), $(revDeltaMin))))))) you can format like this: #[$( [MSBuild]::Add( $(revDeltaMin), $([MSBuild]::Modulo( $(revBuild), $([MSBuild]::Subtract( $(revDeltaMax), ...

NuGetComponent

NuGetComponent Support of NuGet packages. gnt [ v0.12.6+ ] For work with packages via GetNuTool logic (you do not need the gtn.core, it is already part of this component). raw Push raw command to GetNuTool core. void gnt.raw(string command) Arguments: command - Available command to execute. For example: #[NuGet gnt.raw("/p:ngpackages=\"7z.Libs/15.12.0;vsSBE.CI.MSBuild/1.5.1:../packages/CI.MSBuild\"")] #[NuGet gnt.raw("/t:pack /p:ngin=\"D:\tmp\7z.Libs\" /p:ngout=\"newdir/\"")] Notes: The solution directory is path by default for all commands. The get command (/t:get) of GetNuTool is command by default as in original tool. References NuGet GetNuTool SBE-Scri ...

OWPComponent

OWPComponent For work with OWP (Output Window Pane) and similar operations. log v0.11+ Provides data from events of logging. Message Current message from log. Syntax: string log.Message Level The Level of current Message Syntax: string log.Level item [ v0.11+ ] Access to item of the Output window by name. Syntax: item(string name) Arguments: name - Name of item. write Writes data into selected pane. Syntax: void write(boolean force): content Arguments: force - Creates selected item if it does not exist for true value. Sample: #[OWP item("My Item").write(true): mixed data] writeLine Writes data with newline symbol into selected pane. Syntax: void wr ...

SevenZipComponent

SevenZipComponent 7-Zip. File archiver with high compression ratio - www.7-zip.org [ v0.12.6+ ] Configuration Available compression methods Value Description Deflate Combination of the LZ77 algorithm and Huffman coding [?] Deflate64 A slightly higher compression ratio and lower compression time (increased dictionary size - 64kB) [?] BZip2 More effectively than Deflate, but is considerably slower [?] Lzma A high compression ratio than bzip2. Uses dictionary (improved variant of LZ77 + range encoding) and special handling of binary data [?] Lzma2 Efficie ...

TryComponent

TryComponent [ v0.12.8+ ] Protects from errors in try{…} block and handles it in catch{…} Available syntax #[try { ... } catch { ... }] With error type and its message: #[try { ... } catch(err, msg) { $(err) - Type of Exception $(msg) - Error Message ... }] Samples: #[try { #[IO copy.file("$(odir)\Release_notes.txt", "$(pDir)bin\$(cfg)\\", true)] #[7z pack.files({ "$(pDir)bin\$(cfg)\Bridge.dll", "$(pDir)bin\$(cfg)\Bridge.pdb", #[( $(Configuration) ~= "Release" ) { "$(pDir)bin\$(cfg)\Bridge.xml", }] "$(pDir)bin\$(cfg)\Release_notes.txt" }, "$(odir) ...

UserVariableComponent

UserVariableComponent Support of dynamic variables via User-Variables core. Syntax: #[var name] #[var name = mixed value] Samples: #[var branchSha1 = #[File sout("git", "rev-parse --short HEAD")]] #[var ver = #[var ver].#[var revBuild]] Operations v0.11.3+ Unset variable Operator the '-'(minus). Use this as first symbol for variable name that must be removed: #[var -name] Default value for variable You can use this for re/definition variable with default value for compatibility with variables from MSBuild core. Operator the '+'(plus). Use this as first symbol for variable name that must be re/defined by default: #[var +name] Examples Empty string Allowed in v0.11.3+ ...

Direct using of the SBE-Scripts engine.

Direct using of the SBE-Scripts engine If you want to work directly with engine, you should remember about protection of evaluation from used strings: All elements inside quotes ("...", '...') will be automatically protected from evaluation. If you work with standard options, you also should remeber this - Dynamic evaluation with both engines MSBuild & SBE-Scripts What to do if really need evaluation Use any convenient variants to avoid using inside quotes or use also the SBE-Scripts for using quotes. For example, for C# Mode: With MSBuild Property Functions: string type = $([System.String]::Format('"{0}";', #[Build type])) With UserVariableComponent #[var _type = ...

Install and Build

Installation Visual Studio You need VSPackage (.vsix) file. Find it from the Download page. Or see latest binaries from GitHub Releases Page Complete Installation Guide SDK10 / SDK15 versions Starting from VS2019 you need use only SDK15 packages. VS2017: SDK10 or SDK15 (recommended) VS2010, VS2012, VS2013, VS2015: SDK10 CI /Build Servers, msbuild tools: SDK10 or SDK15 Devenv Command Line version: SDK10 API: SDK10 or SDK15 Upgrading to Visual Studio 2019 Known problems [VS2019] Build can be started before activation of our plugin inside VS IDE. This is a feature of the modern VS platform with lazy loading of all plugins. But you can still affect for priority ...