Skip to content

Contributing

Jezz Santos edited this page Mar 9, 2017 · 5 revisions

This page is intended to help developers build and test this project.

Making a code change

  • Clone the repo, and submit a PR.

When you are done, make sure you run the Resharper -> Code Cleanup across the whole solution! (we use the profile called: "ServiceStack.Webhooks")

Tools

The following tools are used to develop this project (others may be used):

  • Visual Studio 2013 (Update 5).
  • Resharper 2016.2.2 - for coding standards and NUnit test runner
  • NCrunch 3.1.0.1 - for TDD

Environment

The only special thing that must be setup in your development environment, is if you are running the integration tests, you are going to need to install your own ServiceStack license, since this project builds and runs more than the [10] free allocation of service operations.

WARNING: Without your ServiceStack license installed, some of the integration tests will fail.

Install Your ServiceStack license

(because we are not allowed to publish a ServiceStack license that we can share, you must have your own).

This project will depend on your service stack license being registered as an ENVIRONMENT Variable, which is option (c) on for licensing: https://servicestack.net/download

SERVICESTACK_LICENSE

Solution

Adding New Projects

If you add a new project to the solution, these are the things you need to do to make it consistent with other projects in the solution. (Some are not immediately apparent).

Note: You can examine any of the existing projects, in all of the following section, to clarify any misunderstanding.

Project Naming

The word "Webhook" is a single word, lower-case "hook". Your project probably needs to start with the prefix "Webhook."

MSBuild targets

We have bunch of shared MSBUILD targets that we use to keep things consistent across all project and to help automate things like the signing of assemblies, and building nuget packages (from *.nuspec), etc.

The shared targets are in a file BuildConfiguration.targets

Once you have created your project, then do this:

  • Unload your project in Solution Explorer (right-click -> Unload Project)
  • Edit the project file (right-click -> Edit Project)
  • Replace the 2nd and 3rd XML section that start with a <PropertyGroup> (The 'Debug' and 'Release' sections) with the following: <Import Project="..\BuildConfiguration.targets"/>
  • Save the file
  • Reload the project in Solution Explorer (right-click -> Reload Project)

Project Properties

Edit the properties of the project and fix the 'Root Namespace' and 'Assembly Name' to start with the prefix "ServiceStack.Webhooks."

AssemblyInfo

Remove all attributes except the following:

using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("ServiceStack.Webhooks.<yourprojectname>")]
[assembly: AssemblyDescription("")]
[assembly: Guid("<AGUID>")]

Make sure that you add: "ServiceStack." to the start of the 'AssemblyTitle' attribute

GlobalAssemblyInfo

From any other project in the solution, expand the 'Properties' folder, and drag and drop the 'GlobalAssemblyInfo.cs' file from that project into the 'Properties' folder of your new project.

Solution Configurations

You must synchronize all project build configurations.

  • Open the 'Configuration Manager' of the solution in Solution Explorer (right-click on solution -> Configuration Manager)
  • Notice that all projects will have the same configuration as the 'Active Solution' configuration
  • Now switch the 'Active solution configuration' to 'ReleaseNoTestDeploy' configuration (from the drop down at the top), and notice that your new projects, have the 'Release' configuration associated to them.
  • Change each of your new projects to 'ReleaseNoTestDeploy'.
  • Switch back the 'Active solution configuration' to Debug
  • Close the 'Configuration Manager' dialog.

Creating Nuget Packages

When the solution builds in the CI environment, and we get a green light, any nuget packages in the solution are automatically built and deployed to nuget.org. (but they will not overwrite the same version as nugets already deployed).

All you have to do to create and publish a new nuget from a project in this solution is the following:

  1. In the same folder as the *.csproj file add a *.nuspec file with exactly the same name as your project file (with a *.nuspec extension)
  2. Then, edit the file, and add the following content:
<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <authors>$author$</authors>
    <licenseUrl>https://github.com/jezzsantos/ServiceStack.Webhooks/blob/master/LICENSE</licenseUrl>
    <projectUrl>https://github.com/jezzsantos/ServiceStack.Webhooks</projectUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <releaseNotes></releaseNotes>
    <copyright>$copyright$</copyright>
    <tags>JezzSantos</tags>
  </metadata>
</package>

Then finally, make sure that the [assembly: AssemblyDescription("<yourdescription>")] is populated in your 'AssemblyInfo.cs' for the project with the *.nuspec file.

Building your Nuget Package

You can then build you .nuspec file into a nuget package (.nupkg) by switching the solution build configuration to 'ReleaseNoTestDeploy', and rebuilding the solution.

You will see you new the built (and versioned) *nupkg files in your project directory.

Clone this wiki locally