In order to support Xamarin.iOS and Xamarin.Android platforms, we had to introduce a breaking change in the names of our NuGet packages. Previously our packages were simply named like Xuni.FlexChart, but now each package now clearly identifies the Xamarin Platform it supports in the name. For instance Xuni.Android.XXX is now for Xamarin.Android and Xuni.Forms.XXX is now for Xamarin.Forms. We hope our current users will understand this was a change that we felt was necessary for the long term future of Xuni. In this blog post I'll walk you through updating an existing project to use the latest packages. If you were using a version of Xuni prior to 2015 v2, and you wish to update to the latest version, here are the quick steps you need to take.
Step 1A: Remove old packages (Visual Studio)
- With your Solution selected in Visual Studio and select Tools – Nuget Package Manager – Manage NuGet Packages for Solution…
- Under Installed Packages, locate a Xuni control library you are using and click Manage.
- Uncheck the boxes for each project in your solution and click OK. You should see a pop-up that asks if you would like to remove its dependencies as well. Click No, since we do not intend to uninstall Xamarin.Forms packages.
- Repeat these steps for each Xuni library in your solution.
Step 1B: Remove old packages (Xamarin Studio)
- For each project in your Solution, expand the Packages folder and locate all Xuni packages.
- Right-click Xuni.FlexChart, Xuni.FlexPie and Xuni.Gauge and select Remove.
- Right-click Xuni.ChartCore and select Remove.
- Right-click Xuni.Core and select Remove.
This will remove the packages and references cleanly while also updating the packages.config file. Note that you can achieve the same result from the Project - Edit References... window.
Step 2A: Add new packages (Visual Studio)
Next you need to add the latest Xuni packages to the Solution. Here's how to quickly do that in Visual Studio.
- In the NuGet Package Manager under Online, select the GrapeCity source.
- Browse through the list until your find the package named Xuni.Forms.XXX where XXX represents the control you are using (FlexChart, FlexPie or Gauges).
- Click Install.
- Select all of the Projects in your solution.
The packages will then install and all dependencies will be resolved. You should Accept the license and you may be required to restart Visual Studio.
Step 2B: Add new packages (Xamarin Studio)
Here's how to quickly add the new Xuni packages to your solution in Xamarin Studio. Repeat the following steps for each project in your solution.
- Right-click the project and select Add - Add NuGet Packages...
- In the Add Packages window, select GrapeCity from the source dropdown in the upper left corner (Note: you must install Xuni to see this option).
- Browse the list of packages and find the one named Xuni.Forms.XXX where XXX represents the name of the Xuni library being used.
- Check the package and click Add Package.
- Repeat these steps for each project selecting the same Xuni package.
Step 3: Update Xuni Namespaces in Code/XAML
Next and finally, you need to update the Xuni namespaces in code and XAML.
- In your iOS project, open up the AppDelegate.cs file. In the FinishedLoading method update any of the initialization lines of code from Xuni.Xamarin to Xuni.Forms.
- In your Windows Phone project, open up MainPage.xaml.cs. In the page constructor update any of the initialization lines of code from Xuni.Xamarin to Xuni.Forms.
- Next, open up any pages in your portable project that use the Xuni controls and update the namespaces from Xuni.Xamarin to Xuni.Forms.
- Rebuild your project and you should be good to go!
If you have trouble building the project, first check out the list of other name breaking changes in the 2015 v2 release. If that doesn't solve the problem then I encourage you to let us know in the forums and we'll help you get back up and running. Once again, we hope our current users will understand this was a change that we felt was necessary for the long term future of Xuni. With the new structure we are able to share packages intelligently across all Xamarin platforms. For instance, when you add the Xuni.Forms.FlexChart package to your Android project in Xamarin.Forms, you'll notice that it picks up the Xuni.Android.FlexChart packages as well. These are the same packages that would be used if you were developing in a Xamarin.Android project.