Continuous Integration is a software development practice to integrate developer codes into a large code base frequently, usually several times a day. Continuous Integration helps to verify automated build with basic test scenarios and Code analysis.
In this article, Git has been used for version control and code repository, while Visual Studio Online (VSO) for Continuous Integration.
- Open the command prompt (run as admin)
- Install chocolatey machine package manager.
- Open the PowerShell editor(run as admin)
- Install Posh-Git with chocolatey
PS C:\> cinst poshgit
- Once installed, close the Powershell editor, and reopen it.
- To verify type “git” and enter.
- Create a Microsoft account, if you don't have one.
- Sign in to Visual Studio Online with your Microsoft account (for example, @outlook.com or @hotmail.com).
Click on New link to create a new team project
It will pop up with ‘new team project’ page
- Add Project name and Description
- Select Process template
- Select Git as Version control
- Click on Create project button
It will create new project under DefaultCollection
Click on Administer account settings
- Click on Agent Pool
Add your live account in the Agent Pool Administrators
Add Visual Studio Project in Git & VSO
Created Hello World Web, test and database projects in Visual Studio
- Open powershell editor
- Go to local project folder location
Type git init command to created git repository
Add user name and email in the git config
>git config –global user.name “Gaurav Srivastava”
>git config –global user.email “Microsoft email”
Add remote VSO url
>git remote add origin “VSO project url”
Add all the project files into git
>git add *.*
Use commit to add files from staging to local repository
>git commit –m <message>
Use push to add files from local repository to VSO repository
>git push –all
- It will ask for VSO credential and password
- Open the VSO project url
- Click on Code tab
Now your code is available under your team project and you can see all 3 (web, test and database) projects.
Continuous Integration using Visual Studio Online
In this section, we will do Continuous Integration with Visual Studio Online.
Sign in to VSO with your Microsoft account.
- Click on BUILD tab
Click on ‘+’ action to create new build definition
Select Visual Studio in the Build template and click on OK button.
New build definition template will open
Select Continuous Integration option from Triggers
Select Default queue as Hosted
- Click on Save button
Enter build definition name and click OK.
Now ‘New Build’ is available under Build definitions
Open Visual Studio TFS and connect to DemoVSO project
- Select Hello World solution
- Add your change in the files
- Save it
- Build the solution
Right click on solution and select Commit
- It will ask to publish your code first.
- To publish, pass the VSO project url.
Enter the comment in message box and select Commit and Push option. It will commit and push your changes to VSO.
- Navigate to VSO under Build tab
- Select New build under build definition
Once you build is successfully completed, It will be visible under the completed section
- Click on Build
It will give you build details view
Click on Artifacts to get the build drop location. You can download/ Explore the build
- Visual Studio Online - https://www.visualstudio.com/en-us/products/what-is-visual-studio-online-vs.aspx
- Git - https://git-scm.com/