Xamarin Projects – Configuration Tips

Use .gitignore

By default, you want to ignore anything that is automatically generated or downloaded. This includes compiler output (e.g. obj files), packages and components, user settings, etc.

Note that if you’re using Xamarin Visual Studio Extension, you probably want to base your .gitignore on a visual studio template.

This is what I use for my projects:


/NuGet
*.apk
*.ap_
*.dex
*.class
bin/
gen/
local.properties
.DS_Store
.idea/workspace.xml
.idea/tasks.xml
.idea/libraries
.gradle
/*/local.properties
/*/out
**/build
/*/*/production
*.iws
*~
*.dll
*.swp
**/obj/
monotouch_dll_content_processed
monotouch_trial
arguments
*.userprefs
*.mdb
Resource.designer.cs
Components/
packages/

Use command line tools to restore components and packages

Since we don’t keep assemblies in the repository, we need a way to restore them.

There are 2 issues here:

  1. Xamarin Studio is not so good in restoring dependencies. Most of the time it fails to restore all dependencies.
  2. If you’re using a CI server you want to be able to restore dependencies from command line.

See my previous post about command line tools for restoring dependencies.

I put both tools in the repository’s root folder so they are always available.

Advertisements

Xamarin – Package and Component Restore

We usually don’t keep packages and components dlls in the code repository.

Sadly, the Xamarin Studio IDE is not very good at restoring packages and components. More often than not, when someone clones a project and opens it for the first time, the IDE will not restore everything.

At this point, the common remedy is to open and close the studio several times, delete the project and re-clone it and other voodoo stuff.

Luckily for us, there are command line tools that you can use to explicitly restore dependencies. They are NuGet.exe and xamarin-component.exe.

I think the original motivation for these tools is CI (and we are using them for CI) but they are also quite useful on developers’ machines.

Note that the NuGet.exe utility is a special mono flavor. Apparently you can’t use the vanilla NuGet utility.

Instructions for use

Download

Download NuGet and the xamarin component tool. I usually add the files to each repository so they are always available to developers and to the build server.

Login to Component Store

To setup the xamarin component tool, you need to login with it to the component store. You do this only once and it will store your credentials info in your user folder so you don’t have to repeat it again


$ mono xamarin-component.exe login me@my.company
Password:
INFO (login): Computed cookie jar path: /Users/doron/.xamarin-credentials
INFO (login): Credentials successfully stored.

Restore Components

To restore components, you run xamarin-component.exe with the restore option and give it the path to your solution file.


$ mono xamarin-component.exe restore MyApp.sln

Restore Packages

To restore packages, you run NuGet.exe with the restore option and give it the path to your solution file.


$ mono NuGet.exe restore MyApp.sln

Summary

We demonstrated the use of NuGet.exe and xamarin-component.exe, 2 command line tools that enable you to manually restore packages and components.

These tools can be used either on a build server or by developers to overcome Xamarin Studio’s problems with restoring dependencies.

Online Diagram Software to draw Flowcharts, UML & more | Creately

“light” diagram tools usually belong to one of 2 types:

Structured Diagraming

These tools make it easy to draw some types of diagrams. For example, a class diagram tool will include such features as a class box with a dedicated area for the class name and another for its properties. With such a tool you will be able to link 2 class objects together with a line so that when you move one of the classes, the line automatically updates so the classes are still linked.
In general, these tools have some semantic understanding of your diagram which they use to make life easy for you.
But the downside for all this help is that you are very restricted to what the tool designers implemented.
If you want to do a different diagram or use a UML feature that is not implemented in the tool, you are out of luck.

Open Tools

These tools will let you do anything – paste clip art, draw lines and text wherever you want. You can create any type of diagram with these tools but doing anything a little complicated will be very hard.

creatly

creatly is a great tool for drawing diagrams.
It doesn’t have a learning curve at all – I just started using it. I didn’t even need to sign up – I used my google account (and you can use other accounts, e.g. facebook).
I found it very versatile and was able to create class diagrams as well as simple mock ups and other types of diagrams.
Whatever I needed was already there. You can drag a class box or a clip art or UI widget. If you hover over an object in the diagram you get a toolbar that lets you easily add text or link the object to other objects using a line or an arrow.
When I finished a drawing, I exported it into a PNG and then just closed the browser tab. The diagram was saved automatically.
This is what I like – my objective is to write a post and I need some diagrams to make the post clearer. creatly let me focus on getting the diagram done with 0 time spent in managing the application.
I can really appreciate the thought that went into designing this tool.
Try it!

Online Diagram Software to draw Flowcharts, UML & more | Creately.

The Road Less Travelled

I always liked the amazing The Road Not Taken.

The Road Less Travelled

I find myself identifying with the feeling of introspect and thoughts this poem conveys.

After a long time of walking the beaten track I am finally taking the other road.
More than 20 years ago, I started programming as a kid because I wanted to make computer games. Somehow, when it was time to start my “real world” career, I just took the first job that accepted me (which was the first job I applied for). My other career choice were no more inspired than my first one.
I never stopped learning and reading about programming but found it very hard to maintain personal projects while having a day job and a family.
Now, in a daring move, I left my job to pursue my heart’s desires. My wife and I calculated that we can carry on (we have 2 kids) for almost a year without income. So my plan for the next year is to explore all the interesting stuff that went on while I was hibernating in not so fun jobs.
This is what I want to do:

  1. Get involved in an interesting open source project
  2. Create a cool web site as a base for experimenting with web technologies. I am currently experimenting with Django
  3. Make games with all kinds of gaming technologies and platforms. I created a prototype with Corona SDK and I really liked working with it. Right now I am working on an IntelliJ IDEA plugin that will aid developing Corona projects in IDEA.
  4. Publish my  adventures in this blog

Hopefully, after one year I will be able to use my newly acquired skills to create a reasonable income.

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I—
I took the one less traveled by,
And that has made all the difference.