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.
Join the DZone community and get the full member experience.
Join For FreePreviously, 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:
Once you click on Create Project, it will create a project with Git as the version controlling system.
Now our project is ready. Once you click on Navigate to Project, it will load project dashboard like this:
Now go to the Build and Release section of the project. It will load the page like below.
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.
We are going to select the ASP.NET Core build in preview mode. Clicking next will load the source control step as seen below.
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.
Clicking on Create will create a build definition like below.
Click on the Save button to save the build definition. It will open up a dialog like below.
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.
To configure the repository in Visual Studio, we need to click on the clone in visual studio. It will open Visual Studio IDE.
Clicking on Clone will clone the repository locally, and then we need to create an ASP.NET core application for that repository.
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.
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.
It will commit changes locally as seen below.
Now click on sync. It will load the Synchronization screen like below.
Now click Push to push the committed changes to the remote Git repository.
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.
After some time, if your commit changes are fine, it will complete the build.
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.
Published at DZone with permission of Jalpesh Vadgama, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments