From the course: Visual Studio App Center for Developers

Set up your first build with Xamarin - Visual Studio Tutorial

From the course: Visual Studio App Center for Developers

Start my 1-month free trial

Set up your first build with Xamarin

- Let's look at how to make a simple build for a Xamarin.Forms App. We have our starting Xamarin App and have already placed it in GitHub. And now we want to use it with VSAC. VSAC supports Bitbucket, Visual Studio Team Services, and GitHub. I'm going to use my personal GitHub account, where I've already added the project and created our sample branches. If you haven't set GitHub up yet, I show you how to do it in the Using the Exercise Files video. The first thing we're going to do is click on the Build icon inside of our App. Once we do that, we can see there are three options on what type of source code repository we want to use. Since this is already on GitHub, I'm going to click on that. Since I've already logged in GitHub with VSAC, it shows me the list of available repositories. You may have to log in here. I'm going to select the VSACXamarin project under my personal organization. Since I want to create a CI Build, I'm going to select the Dev Branch. From here we'll click on Configure build to set up our build definition. Under Project we can select either the solution file or the project file. I'm going to leave it with the solution file for our Xamarin project. If we're doing a Xamarin Android build, only the Xamarin Android project files would show up here, and not the solution files. I'm going to leave the Configuration at Debug, since we're going to do a CI build. Inside Visual Studio we could set many things as part of this build configuration. What projects we want built in the solution, any build variables, if we want to use a shared amount of runtime, or anything else that we could tie to the build definition. We also have some control over the version of Mono being used and the version of Xcode. We're going to leave these at the latest for both of them. We can either build for devices or simulators. iOS device builds require provisioning profiles. Since it is a CI build that we're not going to deploy to a physical device, we're going to select Simulator build as it's going to be a lot faster. We also want this build to happen every time the Dev branch is updated, so we'll leave it at Build this branch on every push. Finally, we'll make sure that the signing is turned off, and press Save & Build. One thing to realize at this point, the build configuration is being set up based on the settings in the solution and project files. This means that if changes are made to these files, the build definition may need to be opened and saved again for all the changes to take effect in the build. This is extremely important to remember and will come up several times during the classes. Okay, cool! Our build definition is complete, and this will let us know if the iOS project can be built every time the Dev branch is updated. Let's go in and do the same thing for Android. So I'm going to go up and click on this red button right here. And this will bring us back to the main application screen. Make sure we've selected our organization, and we're going to click Add new app. So where before we had XamarinApp-iOS, we're going to add in XamarinApp and then Android. And here we're actually going to select it as an Android application for Xamarin. Now we'll go Add new app. And we'll set up our build. We'll click on Build just like we did before, we'll hook up to GitHub, scroll down to select the same repository we had before, which in my case is VSACXamarin. And once again, select the Dev Branch. So now in the Dev Branch it's going to build the Android project. So we'll click Configure build. We're going to actually build the Droid project. And we're going to leave the Configuration with the Debug setting, and the Mono version we'll leave at 5.4.1, the latest version. Once again, we'll just make sure that we're not signing our builds, and we'll click Save & Build. And that's how to set up our build for iOS and Android with Xamarin.

Contents