Join Mark Smith for an in-depth discussion in this video Create an app in Visual Studio, part of Introduction to Xamarin.Forms.
- [Instructor] I'm going to use the new project here on the start page, and I'm going to go to installed templates, Visual C#, cross platform, and then I'm going to pick either blank app Xamarin forms portable or blank app Xamarin forms shared. Again, this is similar to what we had in the wizard in Xamarin Studio, where we could select between the portable class library or the shared project. That's exactly what we're able to do here. I'm going to give this the same name, FirstApp, and I'm going to put it on my desktop and click OK. That's then going to go ahead and generate the project for me.
Now, in this particular case, it's going to take a little bit longer, because it's got to generate an additional project. Since I'm on Visual Studio on Windows, I'm going to get my portable class library project, FirstApp, I'm going to get an iOS version, I'm going to get an Android version, and I'm going to get a Windows phone version. So here, you can see my project's been created. We've got a little getting started page, I'm just going to close that, along with the app.cs that it opened automatically. And I just want to look at the solution structure here. It's going to look identical to what we had in Xamarin Studio, with the exception that now I have a FirstApp.Windows phone version.
This is for Windows phone 8.0 Silverlight. That's what the template currently creates. That will likely change over time, as we migrate more to the universal Windows platform. However, notice that we have the same issue that we had before, in the sense that our references here use Xamarin forms, and if we go look at the packages, we don't actually see it here, but if we go look at the packages, notice that it's a fairly old version, 1.3 here. And so, just like in Xamarin Studio, I'm going to want to right-click on my solution here, and I'm going to go to this manage NuGet packages for solution.
And it will allow me to restore all of my packages, but, even better, I can see that there are updates available. So if I click the updates tab, you can see, I have updates for Xamarin Android support v4. Now we know we're not going to be able to update to that. But I can select this one and update to v220.127.116.1190. That'll go through and update all my NuGet packages for all the projects in my solution. Again, it's one of the first things that I'm likely going to want to do, just to make sure I'm on the most current version of Xamarin forms. Now you can see that we actually have a bunch of other updates that we could apply here.
Again, these are all coming from the support libraries, 23.1.1, we know that that's not compatible with the current version of forms, and so we don't really want to update those. But you can try, it will give you an error in this particular case, but future versions of forms likely will support this. And notice that I did get an error out of Visual Studio as well, the package failed to uninstall, restart Visual Studio to finish this process. All that means is that there's a folder that's left in the directory structure that needs to be deleted. And so you can hit this restart button to go ahead and restart now and remove that folder, or you can do it at a later time.
I'm just going to go ahead and close this. And now we're ready to start actually adding in logic into our app. So now it's your turn to try this.
This course was created by Xamarin University. We are honored to host this training in our library.