Artefacts. How to prepare as you want

Packing & Uploading - Artefacts

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

Artefacts on PC

Read first:

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 Description
bin\Releases\CI.MSBuild_v1.5_[df66438][net40].zip Packed binaries from 'CI.MSBuild' project.
bin\Releases\Devenv_v1.3_[df66438][net40].zip Packed binaries from 'Devenv' project.
bin\Releases\Provider_v3.0_[df66438][net40].zip Packed binaries from 'Provider' project.
bin\Releases\Release_notes.txt Auto-generated notes from current assemblies.
bin\Releases\vsSBE.CI.MSBuild.1.5.1206.nupkg NuGet package from 'CI.MSBuild' project.
bin\Releases\vsSolutionBuildEvent_v0.12.6.5585_[df66438][net40].vsix VSPackage of main project.

Release_notes.txt:

This assembled from:

* Configuration:   'CI_Debug' (Folders: Debug)
* .NET version:     v4.0;
* MSBuild Tools:    v12.0;
* Build number:     5585;
* Branch Sha1:      df66438;
* Branch Name:      master;
* Branch revCount:  323;
------------------------------------------

Versions:

* The 'Bridge':                 v1.3;
* The 'CI.MSBuild':             v1.5;
* The 'Devenv':                 v1.3;
* The 'Provider':               v3.0;
* The 'vsSolutionBuildEvent':   v0.12.6.5585;

Packages:

* NuGet 'vsSBE.CI.MSBuild': v1.5.1206;

Demo:

* ClientDemo - [df66438][net40](5585)

------------------------------------------
         Generated by vsSolutionBuildEvent
------------------------------------------

How to

Please note, you can achieve this result with different modes.

Firstly, you need to decide how will be numbered the versions of all your projects (means the format). It can be as here or other.

Available components of SBE-Scripts: Official list. Or use other mode !

Ok, now we're ready:

  • Select event type - "Post-Build".
  • Change "Processing mode" to 'Script Mode'
  • Add action & Activate SBE-Scripts support

The final script can be like this:

  • Packing - 'Bridge'
#[7z pack.files({ 
            "$(pDirBridge)bin\$(cfg)\Bridge.dll", 
            "$(pDirBridge)bin\$(cfg)\Bridge.pdb",
            
#[( $(Configuration) ~= "Release" ) { 
            "$(pDirBridge)bin\$(cfg)\Bridge.xml",
}]
            "$(pDirBridge)bin\$(cfg)\Release_notes.txt" }, "$(odir)Bridge_v$(numBridge)_[$(branchSha1)][$(netStamp)].zip")]
  • Packing - 'Devenv'
#[var _DP = $(SolutionDir)$(pDirDevenv)bin\#[var cfg]\]

#[IO delete.directory("$(_DP)Devenv", true)]
#[IO copy.directory("", "$(_DP)Devenv", true)]

#[IO copy.file({
                "$(_DP)Bridge.*",
                "$(_DP)Provider.*",
                "$(_DP)Devenv.*"
               },
               "$(_DP)Devenv\\", true, {"Devenv.AddIn"})]

#[( #[IO exists.file("$(_DP)Extensibility.dll")] ) {
    #[IO copy.file("$(_DP)Extensibility.dll", "$(_DP)\Devenv\\", true)]
}]

#[IO copy.file("$(odir)\Release_notes.txt", "$(_DP)Devenv\\", true)]
#[7z pack.files({"$(_DP)Devenv.AddIn", "$(_DP)Devenv\*.*"}, "$(odir)Devenv_v$(numDevenv)_[$(branchSha1)][$(netStamp)].zip")]
  • Rename vsix
#[IO copy.file(
            "$(pDir)bin\$(cfg)\vsSolutionBuildEvent.vsix", 
            "$(odir)vsSolutionBuildEvent_v$(numSBE)_[$(branchSha1)][$(netStamp)].vsix", 
            true)]
  • NuGet Packing - 'vsSBE.CI.MSBuild'
#[var tplNuspec = #[File get("vsSBE.CI.MSBuild.nuspec.tpl")]]
#[var nupCIMdir = $(odir)NuGet-CI.MSBuild-package]

#[IO delete.directory("$(nupCIMdir)", true)]
#[IO copy.directory("", "$(nupCIMdir)", true)]

#[var nuspec = $(tplNuspec.Replace("%CIM%", "$(numCIM)").Replace("%Lib%", "$(libCoreInt)").Replace("%vsSBE%", "$(numSBE)"))]
#[File write("$(nupCIMdir)\vsSBE.CI.MSBuild.nuspec"):#[var nuspec]]

#[" files for package "]

#[IO copy.file("$(CIMLib)\*.dll", "$(nupCIMdir)\bin\\", true)]#[" CIMLib custom "]

#[" vsix dir "]
#[IO copy.file({
                 "$(pDir)bin/$(cfg)\*.dll",
                 "$(pDirCIM)bin/$(cfg)\*.dll",
                 "$(odir)\Release_notes.txt",
                 "3rd-party",
                 "changelog.txt",
                 "LICENSE",
                 "$(pDirCIM)bin/$(cfg)\*.bat" 
               },
               "$(nupCIMdir)\bin\\", true)]

#[NuGet gnt.raw("gnt.core /t:pack /p:ngin=\"$(nupCIMdir)\" /p:ngout=\"$(odir)\"")]
#[IO delete.directory("$(nupCIMdir)", true)]

Where - 'vsSBE.CI.MSBuild.nuspec.tpl' the is a template e.g.:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>vsSBE.CI.MSBuild</id>
    <title>vsSolutionBuildEvent CI.MSBuild</title>
    <version>%CIMVersion%%PackageVersion%</version>
    <authors>...</authors>
    <owners>...</owners>
    <licenseUrl>...</licenseUrl>
    <projectUrl>...</projectUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>                   
    ...
    </description>
    <releaseNotes>Updated the vsSolutionBuildEvent library: v%vsSBEVersion%</releaseNotes>
    <copyright>...</copyright>
    <tags>...</tags>
  </metadata>
</package>
  • For 'Release_notes.txt', use simply:
#[File write("$(odir)\Release_notes.txt"):
...
Versions:

* The 'Bridge': #[$(numBridge)]
....
* NuGet 'vsSBE.CI.MSBuild': v#[var numCIM].#[var libCoreInt];
...
]

As result:

  • All packages should appear in bin\Release folder.
    • You also should ignore this folder in your scm (.gitignore, .hgignore, .bzrignore, svn:ignore, etc.,)

Working example you can see in:

Remote servers

References