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 vsSolutionBuildEvent/1.16.1 [ ? ]

Then call from working dir:

packages\vsSolutionBuildEvent.1.16.1\GUI.bat

Or use ~9 KB helper vsSolutionBuildEvent.1.16.1.bat

After, create ~ build.bat for restoring and activation if no VS IDE.

To activate Events and Actions, for example:

call packages\vsSolutionBuildEvent.1.16.1\cim.cmd ~x

Or use available bootstrap from projects such as Conari, and so on.

That's all. Script what you like.

Obsolete versions before 1.14.1

Execute the following command inside folder where planned :

echo Microsoft Visual Studio Solution File, Format Version 11.00> vssbe.sln
  • Now you can configure .vssbe as you need (via IDE or change it manually)
  • Then, repeat steps above, like for 1.14.1 except activation.

To activate basic Events and Actions, command this, for example:

call "{path_to_package}\bin\CI.MSBuild" "vssbe.sln" /v:m /m:7

To restore package via GetNuTool:

gnt vsSolutionBuildEvent

or before v1.14:

gnt vsSBE.CI.MSBuild

Advanced settings for .sln

You can also add Project records into your .sln if you've plan to work through VS IDE with some your files.

Via IDE, or manually:

To add custom files
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{4318D139-1E55-4525-838D-3853DFAC722B}"
    ProjectSection(SolutionItems) = preProject
        gnt.core = gnt.core
        build.bat = build.bat
    EndProjectSection
EndProject

Where:

  • {4318D139-1E55-4525-838D-3853DFAC722B} - The GUID for new Project record. Generate any new.
  • {2150E333-8FDC-42A3-9474-1A3956D46DE8} - The Solution Folder type.
  • root - The name of Solution Folder.
  • gnt.core, build.bat - list of files that should be available after open .sln
To add .targets-base files

You can also split logic into several steps as project of solution:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "step1.targets", "step1.targets", "{08B06F1F-FC33-4D1E-869B-6BE7E4502294}"
EndProject

Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {08B06F1F-FC33-4D1E-869B-6BE7E4502294}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {08B06F1F-FC33-4D1E-869B-6BE7E4502294}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
EndGlobal

Where:

  • GlobalSection(SolutionConfigurationPlatforms) - Solution configurations - name|Platform
  • GlobalSection(ProjectConfigurationPlatforms) - Project configurations that linked to solution configurations.
    • Release|Any CPU.ActiveCfg - Configuration name
    • Release|Any CPU.Build.0 - flag of build (this line exists when flag is true)

References