Skip to main content

CSharp.Mongo.Migrations

Building and Releasing an Open-source Library using .NET & GitHub

Open-source libraries are a major part of developing software, whether consuming them as libraries through a package manager, interacting with other developers, or contributing back to the community, there aren’t many projects or organisations that don’t rely on open-source software.

This article will cover the basics of getting started with library development in .NET and GitHub using the CSharp.Mongo.Migration library as an example.

Setting Up a Repository (with GitHub)

In software development, version control is a must. If you are already familiar with, and use another source control host, consider skipping this section of the article. Sharing, collaboration, and discussion are all large parts of open-source software development. GitHub is a great (and free, for public repositories) tool to manage:

  • Code with git
  • Documentation through wikis
  • Issue tracking and discussion
  • Simple kanban style project management 
  • CI/CD

Creating the Repository

In order to get started with a new GitHub repository you must first sign up for an account (or use an existing one), after which you will be able to create your repository.

Decisions

There are a number of decisions that should be made before getting started on your open-source library:

  1. Name: this is the user visible name of your repository, and therefore library or project, in .NET this might be your solution name, or root project namespace.
  2. Open-source licence: This licence will help to protect your project from unfair use, see https://choosealicense.com/ for the basics on selecting a licence.
Givens

There are some assumed settings for a new open-source, .NET repository:

  1. Visibility: This should be public, otherwise you aren’t really building an open library!
  2. Readme: All public libraries should have a helpful README.md file, here's an example.
  3. Gitignore: ‘Visual Studio’ is the default ignore file for .NET projects.

Configuring the Repository

You may wish to enable the following extra features for your repository:

  1. Wikis: Consider adding a wiki to document your libraries API.
    1. You may want to restrict editing of the wiki to collaborators only.
  2. Issues: Allows viewers or collaborators to log bugs, or raise ideas for the library implementation.
  3. Projects: Collaborators can view issues in a kanban board and track progress of milestones.

SourceGetting CodeStarted With .NET

There are some assumed settings for a new open-source, .NET repository: