If you would like to build NServiceBus from its sources files, you can do it after downloading the source files from github , getting the latest unstable build, or you can have the latest stable build source code from the downloads page.
Building NServiceBus
You can build NServiceBus by either typing .\build.ps1 in a powershell command line or by executing the build.bat from the command line.
Both files will execute the default.ps1 which is a powershell script file that builds NServiceBus.
Default.ps1 is based on psake build automation tool, you can read about psake, here.
Default.ps1 Has 5 Major Logical Entry Points or Main Tasks:
-
Default No need to call explicitly it calls ReleaseNServiceBus task
-
ReleaseNServiceBus
-
Compiles all the source code in order
-
Runs the unit tests
-
Prepares the binaries and Core-only binaries
-
Creates and publishes the packages to Nuget gallery (access key required)
-
Archives release artifacts in zip
-
-
JustPrepareBinaries was created to shorten build time.
-
Compiles all the source code
-
Prepares the binaries
-
-
PrepareBinaries
-
Compiles all the source code in order
-
Runs the unit tests
-
Prepares the binaries and Core-only binaries
-
-
PrepareReleaseWithoutSamples
-
Compiles all the source code except samples
-
Runs the unit tests
-
Prepares the binaries and Core-only binaries
-
Some more entry points to ease the build activity for development:
-
CompileMain - Build NServiceBus.dll and keeps the output in \binaries
-
TestMain - Build NServiceBus.dll, keeps the output in \binaries
-
CompileCore - Build NServiceBus.Core.dll and keeps the output in \binaries
-
TestCore - Build NServiceBus.Core.dll and keeps the output in \binaries
-
CompileContainers - Builds the container dlls for autofac, castle, ninject, spring, structuremap and MS unity and keeps the output in respective folders in binaries\containers
-
TestContainers - Builds the container dlls for autofac, castle, ninject, spring, structuremap and MS unity and keeps the output in respective folders in binaries\containers and unit tests the same
-
CompileWebServicesIntegration - Builds NServiceBus.Integration.WebServices.dll and keeps the output in \binaries
-
CompileNHibernate - Builds NServiceBus.NHibernate.dll and keeps the output in \binaries
-
TestNHibernate - Builds NServiceBus.NHibernate.dll, keeps the output in \binaries and unit tests the same
-
CompileHosts - Builds NServiceBus.Host.exe and keeps the output in \binaries
-
CompileHosts32 - Builds NServiceBus.Host32.exe and keeps the output in \binaries
-
CompileAzure - Builds NServiceBus.Azure.dll and keeps the output in \binaries
-
TestAzure - Builds NServiceBus.Azure.dll, keeps the output in \binaries
-
CompileAzureHosts - Builds NServiceBus.Hosting.Azure.dll and NServiceBus.Hosting.Azure.HostProcess.exe and keeps the output in \binaries
-
CompileTools - Builds the tools like XsdGenerator.exe, runner.exe and ReturnToSourceQueue.exe and unit tests the same.
-
CompileSamples - Compiles all the sample projects
-
CompileSamplesFull - Compiles all the sample projects after compiling the Source.
Build.ps1
Build.ps1 is a power shell script that is used to execute default.ps1 NServiceBus build script.
The following are examples for executing Build.ps1 script:
-
Array of strings which takes the names of the tasks to be executed.
An example of using it can be for a developer working on a sample, making some modifications in one of the NServiceBus main libraries and to see the effect of the change the developer may execute the following:
NServiceBus> .\build.ps1 @("CompileMain", "CompileSamples")
or just
NServiceBus> .\build.ps1 CompileMain
to build the NServiceBus main libraries -
$properties = @{} this will enable to pass the properties value when invoking default.ps1 for example:
NServiceBus> .\build.ps1 @("InstallDependentPackages","CompileSamples") @{DownloadDependentPackages=$true} -
$desc, pass this parameter to see a description of the task, for example:
NServiceBus> .\build.ps1 -desc
All the examples assumes that user is executing from NServiceBus root folder from Powershell command prompt or Package Manager console of VisualStudio
Build.bat
Build.bat is added to allow users easy way to execute NServiceBus building processes. Usage Examples
> build.bat "@(\"CompileMain\",\"CompileSamples\")"
> build.bat "@(\"InstallDependentPackages\",\"CompileSamples\") @{DownloadDependentPackages=$true}"
