<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Artur Shamsutdinov on Medium]]></title>
        <description><![CDATA[Stories by Artur Shamsutdinov on Medium]]></description>
        <link>https://medium.com/@halkar?source=rss-6564295d95e0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7lwgfNLtbVdQzpvf.jpg</url>
            <title>Stories by Artur Shamsutdinov on Medium</title>
            <link>https://medium.com/@halkar?source=rss-6564295d95e0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 15:17:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@halkar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Best of both worlds: using Grunt to build Xamarin projects on Mac and Windows]]></title>
            <link>https://medium.com/@halkar/using-grunt-to-build-xamarin-projects-on-mac-and-windows-81a4ead48162?source=rss-6564295d95e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/81a4ead48162</guid>
            <category><![CDATA[xamarin]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[grunt]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[gulp]]></category>
            <dc:creator><![CDATA[Artur Shamsutdinov]]></dc:creator>
            <pubDate>Fri, 18 Sep 2015 13:41:10 GMT</pubDate>
            <atom:updated>2016-06-28T08:29:23.177Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/150/0*pys1XqKWzObOjvtP." /><figcaption>Grunt perk in the Fallout: New Vegas</figcaption></figure><p>Couple of weeks ago I opted for <a href="http://gruntjs.com/">Grunt</a> to build my <a href="https://shamsutdinov.net/2015/07/01/tesseract-orc-xamarin-part-1/">Tesseract.Xamarin</a> Nuget <a href="http://nuget.org/packages/Xamarin.Tesseract/">package</a>. Today I will tell you why I decided to take this approach. I will be talking about my own experience and for some of you this information can be obvious but I hope that it will be useful for some of you as well.</p><h3>Some background</h3><p>First of all, I should tell why I decided to use Grunt. As you may already know Xamarin projects can be built on either Windows or Mac host but to build a release iOS app you will need a Mac box.</p><p>Usually build steps are only preserved in your CI tools. But what happens if CI server fails or it’s database is broken? There is no way to save/load the build steps to/from the version control system. So working on my open-source project I was focused on Mac build and was using this simple bash script to automate the process:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/71c15a3af8be4d3fa5cd5a16e1ca6ca3/href">https://medium.com/media/71c15a3af8be4d3fa5cd5a16e1ca6ca3/href</a></iframe><p>As you see there is not so much to do. Update the submodule containing <em>Nuget.exe</em>, restore some nuget packages, build the solution, pack the artefacts. But this code as you can easily guess works only on Mac machines and this fact creates some inequality and you should probably agree with me that any kind of inequality is a bad thing. Ok, let’s make odds even.</p><h3>Preparing the project</h3><p>Grunt and Grunt plugins are installed and managed via <a href="https://www.npmjs.com/">npm</a>, the <a href="https://nodejs.org/">Node.js</a> package manager. So you will need to have <em>npm</em> installed on your machine. You will also need to have Git installed and added to the system PATH.</p><p>Then you will need to create your package definition by adding <a href="https://docs.npmjs.com/files/package.json">package.json</a><em> </em>file into the root folder. This can be easily done in interactive mode by running <em>npm init</em> command. It is even easier if you project is hosted on GitHub. Then some of the data will be populated into the <em>package.json</em> from the GitHub repository for you.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/92086fbcc8ada0843a015ea6e05c42a0/href">https://medium.com/media/92086fbcc8ada0843a015ea6e05c42a0/href</a></iframe><p>Grunt gives all the required tools to build a Xamarin project either on Mac or on Windows machine but I’m using only few of them — <a href="https://www.npmjs.com/package/grunt">grunt</a> itself, <a href="https://www.npmjs.com/package/grunt-msbuild">grunt-msbuild</a> to build the project, <a href="https://www.npmjs.com/package/grunt-nuget">grunt-nuget</a> to handle all the Nuget operations and <a href="https://www.npmjs.com/package/grunt-dotnet-assembly-info">grunt-dotnet-assembly-info</a> to update assembly version.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5f69c8c91f4bf6f7c3b0e66db0170a7/href">https://medium.com/media/e5f69c8c91f4bf6f7c3b0e66db0170a7/href</a></iframe><p>After running these commands plugins will be installed locally and added into your <em>package.json</em> as <em>devDependencies</em>.</p><p>Usually you also need to install <em>grunt-cli</em> plugin <a href="https://docs.npmjs.com/getting-started/installing-npm-packages-globally">globally</a> to run Grunt from the command line. But I prefer a different approach. Let’s add one more small script to the <em>package.json</em> to simplify build process.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb8adfebb630a1d346c73adad8dba8cc/href">https://medium.com/media/eb8adfebb630a1d346c73adad8dba8cc/href</a></iframe><p>Complete file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3483ea26c3460dcc11d970ae2286ece8/href">https://medium.com/media/3483ea26c3460dcc11d970ae2286ece8/href</a></iframe><h3>Building Xamarin project with JavaScript</h3><p>To setup Grunt build you will need to add <a href="http://gruntjs.com/getting-started">Gruntfile.js</a>. Here is my version.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/113561aa4ca11835fae383360c21d926/href">https://medium.com/media/113561aa4ca11835fae383360c21d926/href</a></iframe><p>It has only four tasks, <em>nugetrestore:restore</em> to restore all nuget packages we need, <em>assemblyinfo</em> to update assembly version, <em>msbuild:release</em> to build the project and <em>nugetpack:dist</em> to create the nuget package which will be used to distribute Xamarin.Tesseract. As you can see configuration is uncomplicated and replicates the bash script which I was using before.<br> One small detail to notice. There is a package version in the <em>package.json</em> file and there is a package version in the <em>Xamarin.Tesseract.nuspec </em>(also I would like my libraries to have same version). As nobody likes duplications I will be using version from the <em>package.json</em> for my nuget package. To use it I read package data</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dced33bd3b16285f4b5d17a9cd8c2449/href">https://medium.com/media/dced33bd3b16285f4b5d17a9cd8c2449/href</a></iframe><p>and then use package version in the <em>nugetpack:dist</em> task</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/757f920323be34f59c48daeae1e3fb20/href">https://medium.com/media/757f920323be34f59c48daeae1e3fb20/href</a></iframe><p>and in the <em>assemblyinfo</em> task</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9020fa970c8a3156df2da5f3b3b6d8e1/href">https://medium.com/media/9020fa970c8a3156df2da5f3b3b6d8e1/href</a></iframe><p>Now you can build the project after cloning the repository by running just two commands.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/032460c361674e47d3f08d77c54d9182/href">https://medium.com/media/032460c361674e47d3f08d77c54d9182/href</a></iframe><p>And the best part is that now you can use the same steps to build the project on either Mac or Windows without any changes. On Windows you will need to open Visual Studio once to establish connection with the <a href="https://developer.xamarin.com/guides/ios/getting_started/installation/windows/introduction_to_xamarin_ios_for_visual_studio/#Build_Host_Settings">Mac build host</a>. Another positive thing is that I don’t need the nuget submodule anymore as <em>grunt-nuget </em>brings Nuget.exe and deploys it locally.</p><h3>My personal outcomes</h3><p>As a reusable code fanatic I’m now happy with my build process. I can extend it using hundreds of Grunt plugins with both platforms supported. For example, run unit tests with <a href="https://www.npmjs.com/package/grunt-nunit-runner">grunt-nunit-runner</a>, automatically push new version to the Nuget server with <a href="https://www.npmjs.com/package/grunt-nuget">grunt-nuget</a> and even publish your app in <a href="https://www.hockeyapp.net/features/">HockeyApp</a> with <a href="https://www.npmjs.com/package/grunt-hockeyapp-upload">grunt-hockeyapp-upload</a>. I can shuffle build steps without touching the CI server and my overcomplicated build configuration won’t be decayed even if server goes off. Configuration is saved in the VCS which means it can be rolled back to any previous version and deployed to any number of servers.</p><p>So I’ve found my paragon and what do you use to build your projects?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81a4ead48162" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[First blog post or how to choose your pony]]></title>
            <link>https://medium.com/@halkar/first-blog-post-or-how-to-choose-your-pony-a5a9dd99d842?source=rss-6564295d95e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5a9dd99d842</guid>
            <category><![CDATA[xamarin]]></category>
            <category><![CDATA[xaml]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Artur Shamsutdinov]]></dc:creator>
            <pubDate>Tue, 02 Jun 2015 10:13:15 GMT</pubDate>
            <atom:updated>2016-06-28T08:27:45.197Z</atom:updated>
            <content:encoded><![CDATA[<p>This is my first ever blog post so it could be a little bit muddled. Today I’d like to present funny and maybe useful stuff for Xamarin.Forms (yes I like Xamarin.Forms). I will show how to implement theming in Xamarin.Forms.</p><p>Let’s start with this classy page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*CWXzI2pNVNE964xYkTNlKg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*CKE5nfDsEXoux8TuOcHFjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*PG-kyZnQaONcac7hBlSBiw.png" /></figure><p>But we want our user to be really happy hence we add a second theme. So how can we define our theme and how can we switch between themes in the runtime? First we will add our themes to App.xaml. Of course I will be using XAML (oh, yeah, I love XAML!) and resource dictionaries.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/32f356673d0e4c64c15f1d469b1869c6/href">https://medium.com/media/32f356673d0e4c64c15f1d469b1869c6/href</a></iframe><p>Now we have two themes Default and Second. Let’s write some code to choose the theme we like.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e2e6002125cce44bc2c7708ddd3de2b8/href">https://medium.com/media/e2e6002125cce44bc2c7708ddd3de2b8/href</a></iframe><p>And now we can easily switch between our themes. To test I will add this page (of course it will be XAML, have I told that I love it?).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31068f43222450523dbabdcee55a3257/href">https://medium.com/media/31068f43222450523dbabdcee55a3257/href</a></iframe><p>One thing to remember. To be able to switch between our themes without restarting the app we will have to use <em>x:DynamicResource</em> instead of <em>StaticResource </em>to tell Xamarin that this resource could be changed during app’s life.</p><p>Now we will need just little code to breathe some life in our application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/593752935d53cb8f11e3b89db0854c4b/href">https://medium.com/media/593752935d53cb8f11e3b89db0854c4b/href</a></iframe><p>And now we can choose our pony.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*4IcCsF0-r8j-46Pb98mzHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*LMxRZdXb9hpS9vqkzAIuuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*LeLt1RFM8wdG8AQghT4ZCg.png" /></figure><p>Of course this applications is primitive and we have no theming for buttons or the status bar, nor is the theme saved between sessions, but it gives an idea of how we can play with resource dictionaries in Xamarin.Forms. The same approach can be used for localisation but I won’t recommend doing that (there is much <a href="http://developer.xamarin.com/guides/cross-platform/xamarin-forms/localization/">better way</a>). I hope it was not that bad for the first time. Hope I’ll stop procrastinating (and playing Fallout NV, oh!, I have three more DLC!) and next post will be in this year.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5a9dd99d842" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>