Skip to content

Tutorial.03 Setting up Visual Studio Solution

Wim van Gool edited this page Jul 16, 2019 · 1 revision

To kick-off our tutorial, we are going to take you through the process of setting up your Visual Studio Solution. At the time of writing, Visual Studio 2019 has just been released, so we are going to use this version, but any other version that supports .NET Core and/or .NET Standard will suffice.

Creating a new Solution with all Solution Folders

The solution we are going to setup will mimic the MicroService Architecture as explained in the previous chapters. That means the structure of our solution will reflect the structure of our service. Open Visual Studio, create a new Black Solution and name it MasterMind. Now add the following three Solution Folders:

  • Clients.Console
  • Server.Contract
  • Server.Implementation

These folders represent the main components of our service: the front-end in the form of a Console Client and the back-end, divided into its Contract and its Implementation. By prefixing all front-end components with Client and the back-end components with Server emphasizes the generic client-server architecture of the service. In addition, this naming-scheme orders the projects in such a way that the back-end implementation is as the bottom of the solution, with the front-end components laying on top of it, and the contract in the middle, which nicely visualizes the role of each component in this architecture.

The Server.Implementation folder is going to contain all the projects that represent the layers of the Onion Architecture. To make this explicit, we are going to create one folder for each layer. This time, we need to prefix the folders with A, B and C to enforce the visual ordering of these layers. The resulting solution looks like this:

Solution Folders

Adding all projects to our Solution

We are now going to add all projects to these Solution Folders. Let's start with the Contract. Recall from the theory that the Contract represents a library that is potentially shared between both front-end and back-end or between this service and other services. As such, it makes sense to make our library a .NET Standard library, so that consumers of your Contract could use any .NET Platform they like.

So to add the Contract-library, right-click the Server.Contract folder, choose Add -> New Project... and select Class Library (.NET standard). Name the project Contract and create it.

Clone this wiki locally