One think I’ve learned today: Vim!

I was recently struck with how productive a developer could be when using a text editor and keeping his hands on the keyboard.  Sure, I’d coped with Vi 20 years ago in university but I’d been relieved when “better” graphical editors eventually came along for my mouse-driving pleasure.

But still:  Productivity such as I was witnessing was worth investigating.  So with courage in hand I installed Vim and went through the tutorial to learn the basic commands.  Now, I’m inventing reasons to use Vim just so I can get more adept at it.

I’m still young enough to learn new tricks.  What have you learned today?

Getting Started with Universal Apps

On a whim, I decided to create a new Universal App. If you haven’t been following the news, Microsoft announced Universal Apps at the Build 2014 conference. The term is used to refer to an application that is created and that will share code for multiple platforms such as Windows 8.1, Windows Phone 8.1, Android and iOS, amongst others.

In order to get access to the latest project templates, I installed Visual Studio 2013 Update 2 Release Candidate which can be found here.

Once that was done, here are the steps I followed:

In Visual Studio 2013, I created a new project and selected the Blank App (Universal Apps) option. I could have picked the Hub App but I wanted to create my own application from scratch.

New Project

I called my application the CalendarEventCreator.

This created a solution that contained 3 projects: one for Windows 8.1, one for Windows Phone 8.1, and a Shared component where shared XAML and code would reside.

2

This is good but the shared component is a way of linking files into both projects above. This means that the shared files are built directly into every one of the executables within the same solution. I prefer to have the bulk of my shared code reside in a class library so that it can be unit tested and built only once but referenced by various executables. This means if the shared code changes, I am not forced to rebuild and ship every executable. Here’s an excellent blog post that helps make sense out of both types of shared components: Sharing Code Across Platforms. For my project, I chose to create both a Portable Class Library called CalendarEventCreatorShared and a matching test project. My solution now looks like:

3

As the test project will be testing the portable shared library, I went to add a reference to the library from the test project. This, however, failed with the following message:

Error message

To solve this, I had to do two things:

  1. Go into the portable class library’s properties by right-clicking the project in the Solution Explorer and add “.NET Framework 4.5.1” as a target.
    Library targets
  2. Go into the unit test project’s properties by right-clicking the project in the Solution Explorer, change the framework to version 4.5.1 and accept the warning.
    6

After having accomplished this, I was able to add a reference to the portable class library into my test project and started doing some real coding…which unfortunately will be a story for another time.

Hope this helps you get started with Universal Apps!