Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

ASP.NET Core Application CI With Visual Studio and Git

DZone's Guide to

ASP.NET Core Application CI With Visual Studio and Git

We're going to see how to do CI for ASP.NET Core 1.0 using use Visualstudio.com as the source control repository and Git as the version controlling system.

· DevOps Zone
Free Resource

The Nexus Suite is uniquely architected for a DevOps native world and creates value early in the development pipeline, provides precise contextual controls at every phase, and accelerates DevOps innovation with automation you can trust. Read how in this ebook.

Previously, I've written a couple posts about Continuous Integration, and this post is a part of that series. Recently, Microsoft released ASP.NET Core 1.0. In this post, we are going to see how we can do Continuous Integration for the ASP.NET Core application. I am going to use visualstudio.com as our source control repository and Git as our version controlling system. Let’s get started.

The first thing we need to do is create a project into VisualStudio.com like this:

VisualStudioProject

Once you click on Create Project, it will create a project with Git as the version controlling system.

naviagte-to-project

Now our project is ready. Once you click on Navigate to Project, it will load project dashboard like this:

project-dashboard

Now go to the Build and Release section of the project. It will load the page like below.

build-release-visual-studio-com

To enable Continuous Integration for this project, we need to create a new build definition. Click on the green Plus icon on the left side. It will load a wizard to create a build definition. The first screen presented with default templates as seen below.

build-definition-wizard-template-selection

We are going to select the ASP.NET Core build in preview mode. Clicking next will load the source control step as seen below.

build-defintion-git-settings-step

Here, we are using visualstudio.com, so we are not going to change anything. However, we are going select Continuous Integration to enable Continuous Integration as seen below.

build-defintion-git-settings-continuous-integration

Clicking on Create will create a build definition like below.

build-definition-wizard-completion

Click on the Save button to save the build definition. It will open up a dialog like below.

core-build-definition

Clicking on OK will save the build definition. Now we are done with the configuration of Continuous Integration. Now, it's time to add the code to check whether this configuration is working or not. To add code, click on the code menu on visualstudio.com. It will load the following screen.

git-code-page-visualstudio

To configure the repository in Visual Studio, we need to click on the clone in visual studio. It will open Visual Studio IDE.

team-explorer-visual-studio

Clicking on Clone will clone the repository locally, and then we need to create an ASP.NET core application for that repository.

create-net-core-application

Clicking on Open will create an ASP.NET core web application. Once you are done creating the application, we need to push our code to master branch so that we can see whether our Continuous Integration is working or not. To push the changes, go to Team Explorer. It will load screen like below.

team-explor-visual-studio-after-create

Click on Changes to show the changes that have been made to the Git repository as seen below. Put a commit message and click on Commit All.

changes-team-explorer-visual-studio

It will commit changes locally as seen below.

commit-local-team-explorer-visual-studio

Now click on sync. It will load the Synchronization screen like below.

sync-screen-team-explorer

Now click Push to push the committed changes to the remote Git repository.

pushed-changes-visual-studio

It will push changes to the master branch. Now to check Continuous Integration go to build definition section of visualstudio.com. A build should be queued up for the changes we have made as seen below.

build-queued-up

After some time, if your commit changes are fine, it will complete the build.

completed-build-visual-studio

You can see that our Continuous Integration is working fine. It’s pretty easy to set up. Hope you like it; stay tuned for more.

The DevOps Zone is brought to you in partnership with Sonatype Nexus.  See how the Nexus platform infuses precise open source component intelligence into the DevOps pipeline early, everywhere, and at scale. Read how in this ebook

Topics:
tutorial ,asp.net ,continuous integration ,git ,visual studio ,devops

Published at DZone with permission of Jalpesh Vadgama, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}