Skip to content

Event-Catcher with variety of advanced Actions to service projects, libraries, the build processes and processes at runtime from VisualStudio and MSBuild Tools.

License

teedymac1987/vsSolutionBuildEvent

 
 

Repository files navigation

Event-Catcher with variety of advanced Actions to service projects, libraries, the build processes and processes at runtime from Visual Studio and MSBuild Tools.

Control everything: Visual Studio, MSBuild Tools, CI, and more …

Build status - master VSIX nuget package LGPLv3 GetNuTool SobaScript E-MSBuild

Build history Event model Short Overview

CI.MSBuild Devenv Provider API Tests

Download (Binaries, Snapshots, Nightly builds, Libraries, ...) / D2 (old releases via sf)

License

Licensed under the LGPLv3

Copyright (c) 2013-2016,2019  Denis Kuzmin < entry.reg@gmail.com > GitHub/3F

[ ☕ Donate ]

Why vsSolutionBuildEvent ?

Advanced handler of the most events from MS Visual Studio & MSBuild tools. Full control and flexible multi-actions for basic pre/post events and other additional such as:

  • CommandEvent, Errors, Warnings, Cancel-Build, Output-Build, Transmitter, Logging

Ability to handle events for all subprojects at once from the whole solution as an Solution-Events or individually for each separately.

Various modes for everything:

Supports additional MSBuild features & SBE-Scripts engine for your awesome ideas.

Possible work even without Visual Studio.

Provides also support of the CI-Build Servers (TeamCity, AppVeyor, Azure DevOps, ...), Command-Line mode and lot of other features for the convenience of your work with the build, tests, versioning, IO operations, and so on. See the documentation.

Scheme of vsSolutionBuildEvent projects

Advanced MSBuild

Through E-MSBuild engine.

#[$(
    [System.Math]::Exp('$(
        [MSBuild]::Multiply(
            $([System.Math]::Log(10)), 
            4
        ))'
    )
)]
$(n = 0)       $(desc = "Hello ")
$(n += 3.14)   $(desc += "from vsSBE !")
$(n += $(n))   $(p1 = " Platform is $(Platform)")
$(...)
$(...:project) - from selected project in your solution
$$(...) ... $$(...:project)
$(tStart = $([System.DateTime]::Parse("2014/01/01").ToBinary()))
$([System.Guid]::NewGuid())

$([System.TimeSpan]::FromTicks($([MSBuild]::Subtract($(tNow), $(tStart))))
                        .TotalHours.ToString("0"))

$(pdir = $(ProjectDir:project))
$(pdir = $(ProjectDir.Replace('\', '/'):project))

#SobaScript

https://github.com/3F/SobaScript -- Extensible Modular Scripting Programming Language.

#["
    #SobaScript in action
"]
#[var v = 1.2.3]
#[$(log = "$(TMP)/v.txt")]

#[($(Configuration) ~= Deb || true)
{
    #[var tBase     = $([System.DateTime]::Parse('2019/08/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)))]

#[try
{ 
    #[File write("#[var log]"):> Example #[var v] Generated by a vsSolutionBuildEvent]
    #[IO scall("notepad", "#[var log]")]
}
catch(err, msg)
{
    $(err) - Type of Exception
    $(msg) - Error Message
}]

For example, you can even exclude projects from build at runtime:

#[Build projects.find("name").IsBuildable = false]

Capture data from external utilities:

#[var bSha1 = #[IO sout("git", "rev-parse --short HEAD")]]

Work with files and archives:

#[IO copy.file("$(odir)/notes.txt", "$(pDirCIM)bin\\$(cfg)\\", true)]
#[7z pack.files({
            "$(pDirBridge)bin\$(cfg)\Bridge.*.*",
            "CI.MSBuild.dll",
            "CI.MSBuild.pdb",
            "$(pDirCIM)bin\$(cfg)\*.txt"}, "$(odir)CI.MSBuild_v$(numCIM)_[$(branchSha1)][$(netStamp)].zip")]

+DTE-commands, +Access to all MSBuild properties on the fly, +Conditional statements and lot of other components:

#[try
{
    #[Box iterate(i = 0; $(i) < 10; i += 1): 
        ...
    ]
}catch{ }]

#[( #[vsSBE events.Pre.item(1).Enabled] || ($(Configuration) == "Release" && $(sysc)) )
{
    #[Build projects.find("name").IsBuildable = false]
}
else
{
    #[var bSha1 = #[IO sout("git", "rev-parse --short HEAD")]]
    ...
}]

... create new in 5 minutes

Processing modes

https://vssbe.r-eg.net/doc/Modes/

From simple commands to C# or even msbuild targets:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <Target Name="Init">
        <!-- ... -->
    </Target>

    <!--
        Additional properties:
            $(ActionName)
            $(BuildType)
            $(EventType)
            $(SupportMSBuild)
            $(SupportSBEScripts)
            $(SolutionActiveCfg)
            $(StartupProject)
    -->
</Project>

CommandEvent (DTE)

You can also use this to catch all command from VS IDE. 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)]
}]

Automatic Version Numbering

See our Wizard for automatic code generation or use any custom scripts.

Different environments

You can easily use this with TeamCity, Azure DevOps, AppVeyor, and any other automated environments:

...

Solution-wide Build events

Pre-Build / Post-Build events for all projects at once or individually for each separately: configure what you need.

Stop build on first error

Immediately stop (at the same time) after the first appearance (compared with StopOnFirstBuildError plugin [?])

Wiki

Wiki - Contains help for work with plugins, basic examples, syntax, information for develop, and lot of other...

Feel free to improve any our pages. Click [Edit] button or Start new here.

Questions / Bugs / Suggestions / Source Code

Welcome:

Screenshots

[. . .]

About

Event-Catcher with variety of advanced Actions to service projects, libraries, the build processes and processes at runtime from VisualStudio and MSBuild Tools.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 97.4%
  • Batchfile 2.5%
  • Smarty 0.1%