Create Bot for Microsoft Graph with DevOps 4: Continuous Integration – Build Definition

As I have basic application, it’s time to setup CI (Continuous Integration).

Create Build Definition

1. Go to Visual Studio Team Services and go to Build & Release | Build. Click [New definition].

image

2. Select ASP.NET (PREVIEW) template.

image

3. Set name.

image

4. Select [Get sources] and select the repo. As you see, you can use other repository such as GitHub.

image

5. Select [Test Assemblies] and update Test assemblies field. As the unit test assembly name is O365Bot.UnitTests.dll, I changed it like below.

image

6. I also enabled Code coverage. Select any other options as you want.

image

7. I want to copy files to artifact, so click [Add Task]

8. Select [Copy Files] and add. You can filter by search.

9. Set source folder to $(build.sourcesdirectory) and set Contents to **\bin\$(BuildConfiguration)\**, Target Folder to $(build.artifactstagingdirectory).

10. Change the order under Publish Artifact.

11. Now, set the CI. Select [Triggers] tab and enable [Continuous Integration]. It’s so easy, you know.

image

12. Click [Options] tab and set [Hosted VS2017] as Agent
※ You can see what components are included in the agent at here.

image

13. I also enabled [Create work item on failure] which creates work item when compilation failed.

image

14. Click [Save & queue]

image

15. While running, you can see the actual log.

image

Trigger from check-in

Now you can check-in any change from Visual Studio and it automatically does build.

Summery

Now CI completed. I will explain function test next.

Ken