Skip to content

3F/vsCommandEvent

Repository files navigation

vsCommandEvent

Extending Visual Studio on the fly via E-MSBuild, SobaScript, C#, ...

Build status VSIX GetNuTool SobaScript E-MSBuild

Copyright (c) 2015-2022  Denis Kuzmin <x-3F@outlook.com> github/3F

@ ☕ 」 LGPLv3

Download

Why vsCommandEvent ?

vsCommandEvent was based on vsSolutionBuildEvent engine to continue the mission of providing flexible customization for your environment and its automation.

Yet another advanced handlers of the most events but unlike the first it was focused on advanced manipulations with Visual Studio IDE and its runtime.

Overriding commands

The development environment of any users can be flexibly changed according to your needs in a few steps.

This is possible because vsCommandEvent may override a lot of things from IDE. It also provides flexible actions due to the fact that it was based on vsSolutionBuildEvent.

You can even override the 'Exit' (including [X] and Alt + F4 hotkey) for Visual Studio IDE on the fly depending on some state of the document etc.

A new look at old things

Why not look at some similar solutions from vsSolutionBuildEvent.

Although it cannot be same as for vsCommandEvent (since it was based on another technologies), let's try to look closer. Can we achieve the same result?

Solution-wide Build Events

vsCommandEvent initially may work with commands from VS. Thus, you can catch commands when starting the any Build operations still for the entire solution or individually for each project separately.

This is it ~

Description Guid Id in out
Started - Build Solution {5EFC7975-14BC-11CF-9B2B-00AA00573819} 882
Started - Rebuild Solution {5EFC7975-14BC-11CF-9B2B-00AA00573819} 883
Started - Clean Solution {5EFC7975-14BC-11CF-9B2B-00AA00573819} 885

Automatic Version Numbering

Still available versioning as you prefer. Moreover, with the vsCommandEvent you can handle versioning for most operations of Visual Studio. Just try as you need.

Stop build on first error

Disturbs [Warnings] and [Errors] ?! no problem, manage it:

Advanced Actions

vsCommandEvent provides most of the action types from vsSolutionBuildEvent engine:

  • Files Mode, Operation Mode, Interpreter Mode, Script Mode, Targets Mode, C# Mode, and more such as EnvCommand Mode etc.

Supports advanced MSBuild & SBE-Scripts engine for powerful usage. And lot of other features for the convenience of your work with the build, tests, versioning, IO operations, and so on. See the documentation.

A few modes for you:

Targets Mode

You can even work with MSBuild Targets / Tasks and other 'as is' (classic compatible mode).

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

    <Target Name="Init">
        <!-- your awesome code ... -->
    </Target>
    
</Project>

C# Mode

You can also choose this as an preferred action type.

namespace vsCommandEvent
{
    public class CSharpMode
    {
        public static int Init(ICommand cmd, ISolutionEvent evt)
        {
            // your awesome code ...
        }
    }
}

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)")

...

#SobaScript

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

#["
    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)

Use our available components or extend everything by creating new.

Wiki

Read or Edit

🖼️

[ . . . ]