Scott Hanselman

Catch up on all the videos from DotNetConf Spring 2014

July 3, '14 Comments [11] Posted in Learning .NET
Sponsored By

Did you miss out on DotNetConf when it streamed LIVE just a few weeks ago? Don't you worry, it's all recorded and online for you to stream or download!

We are happy happy to announce that we’re planning another .NET Conf to be happening in a few months, so keep tuned thru the .NET Conf Twitter account (Twitter: @dnetconf), or checking our .NET Conf site in the future: http://www.dotnetconf.net. Big thanks to Javier Lozano for all his work with the site and conference coordination.

Everything was recorded is is up here: http://channel9.msdn.com/Events/dotnetConf/2014

.NET Conf summary and recorded content

The .NET Conf 2014 was a two-day virtual event (June 25th-26th) focused on .NET technologies, covering application development for the desktop, mobile and cloud/server. It is hosted by the MVP community and Microsoft, bringing top speakers and great topics straight to your PC.

Below you can review all the delivered sessions and reach to their related recorded content.

Day 1 – .NET core and .NET in client/devices

clip_image001 State of .NET (Keynote) - Jay Schmelzer
Opening and overview of current .NET state and .NET on the Client side.

clip_image002

New Innovations in .NET Runtime

Andrew Pardoe

We're changing the way we execute code in the .NET Runtime. Hear about .NET Native, RyuJIT, and modern server strategy.

clip_image003

The Future of C#

Kevin Pilch-Bisson, Mads Torgersen

The Microsoft Managed Languages team has been focused on rebuilding the VB and C# compilers and editing experiences as part of Project "Roslyn". This effort has paved the way for these languages to continue evolving for many years to come. However, what does that future actually look like? We explore the editing experience, how public APIs may be used to write language-level extensions, as well as new language features.

clip_image004

Building Universal Windows Apps with XAML and C# in Visual Studio

Larry Lieberman

In April at Build 2014, Microsoft unveiled universal Windows apps, a new approach that enables developers to maximize their ability to deliver outstanding application experiences across Windows PCs, laptops, tablets, and Windows Phones. This means it's now easier than ever to create apps that share most of their code. Code can be shared using the new shared app templates, as well as by creating Portable class libraries. This session will walk through the development of a shared app and will discuss where it still makes sense to implement platform specific features.

clip_image005

.NET Native Deep Dive

Andrew Pardoe

Look inside the .NET Native compiler toolchain to understand how we enable .NET Windows Store apps to compile to self-contained native apps.

clip_image006

Fun with .NET - Windows Phone, LEGO Mindstorms, and Azure

Dan Fernandez

In this demo-packed session, we'll walk through building your first .NET controlled LEGO Mindstorm using Windows Phone. You'll learn about the LEGO EV3 API, how to control motors and read sensor data, and how to batch commands to the robot. Once we have a working, drivable robot, we'll switch to cloud-enabling the robot so that you can drive the robot remotely via a Web site hosted in Microsoft Azure.

clip_image007

Kinect for Windows

Ben Lower

We will take a look at what's new in Kinect for Windows v2 including the improvements in core sources like Infrared and Depth data.  We will also show how the new Kinect Studio enables Kinect development even while travelling via plane, train, or automobile (note: you should not dev and drive) and how Kinect Interactions can be used to add a new input modality to Windows Store applications.

clip_image008

What's New in XAML Platform & Tooling

Tim Heuer

Tim will do a lap around what is new to the Windows Phone 8.1 platform as well as a tour of the new XAML tooling in Visual Studio Update 2 for developers and designers.

`clip_image009

Developing Native iOS, Android, and Windows Apps with Xamarin

James Montemagmo (Xamarin)

Mobile continues to expand and evolve at a rapid pace. Users expect great native experiences in the palm of their hands on each and every platform. A major hurdle for developers today is that each platform has its own programming language and tools to learn and maintain. Even if you tackle the burden of learning Objective-C and Java you will still have to manage multiple code bases, which can be a nightmare for any development team large or small. It doesn't have to be this way as you can create Android, iOS, Windows Phone, and Windows Store apps leveraging the .NET framework and everything you love about C#.

clip_image010

What's new for WPF Developers

Dmitry Lyalin

Windows Presentation Foundation (WPF) enables .NET developers to build rich and powerful Windows desktop applications using managed languages and XAML. In this session we'll cover all the latest innovations available to WPF developers such as improvements coming from .NET, integration points with the latest cloud technologies and enhanced tooling & profiling capabilities in Visual Studio.

Day 2 – .NET in server and cloud

clip_image011

ASP.NET Today and Tomorrow (Keynote)

Scott Hunter

It's been an amazing decade for ASP.NET. Today in 2014, most all of ASP.NET is open source, developed in the open, and accepting community contributions. One ASP.NET and VS 2013 added some amazing new tooling enhancements for HTML5, CSS3 and JavaScript. VS2013.3 is coming soon with even more innovations as we march towards ASP.NET vNext. Join Scott Hunter as he shows you how it works together. What's available on ASP.NET today, and where is ASP.NET headed tomorrow, and what do you need to know to best support the code you've written and the code you will write. We'll also talk about the rise of the cloud and how it changes the way we write large systems. All this, plus a lot of open source, and deploying to Azure.

clip_image012

ASP.NET Web Forms

Scott Hunter, Pranav Rastogi

Do you want to learn techniques to enhance your Web Forms development experience. See how you can improve your code's maintainability and testability and your site's performance. Leverage new features in ASP.NET Web Forms 4.5 to reduce the amount of UI "yuck" code and focus on your application's logic. We will look at some of the improvements to Web Forms such as support for EF 6, new Scaffolders and more features which you might not have heard of. We will see how to leverage all of the latest tools in Visual Studio like Browser Link and Web Essentials to make their coding experience simpler, shorter, and more enjoyable. 

clip_image013

ASP.NET MVC 6 (now with integrated Web API!)

Daniel Roth

ASP.NET MVC and ASP.NET Web API in ASP.NET vNext are becoming one singular framework: ASP.NET MVC 6. Join Daniel Roth as he shows how to create great ASP.NET web apps that serve both pages and services. First we'll see how to build OData v4 compliant services using ASP.NET Web API 2.2 and the new attribute routing features available in ASP.NET MVC 5.2. Then we'll take a look at how ASP.NET MVC and Web API are being combined into a single framework, ASP.NET MVC 6, for handling all of your Web UI and services. We'll learn how to use ASP.NET MVC and Web APIs in ASP.NET vNext to support connected applications for browsers, Windows Phone, Windows Store and more!

clip_image014

Entity Framework (v6 and v7 preview)

Rowan Miller

Entity Framework is Microsoft's recommended data access technology for new applications in .NET. We'll explore how the current release of Entity Framework can be used to build applications. We'll also look at an early preview of EF7, a modern, lighter weight, and composable version of Entity Framework (EF) that can be used on a variety of platforms, including ASP.NET vNext, Windows Phone and Windows Store. This new version will also support targeting non-relational data stores.

clip_image015

Taking Your ASP.NET Apps to the Cloud with Microsoft Azure Web Sites

Brady Gaster

Web developers are seeing huge boosts in their productivity building Web Applications with ASP.NET, with so many huge improvements to Visual Studio focused on the problems web developers solve each day. We've also made some significant improvements in Microsoft Azure for web developers by concentrating on providing the community the best cloud in which to host ASP.NET web apps. Features like Auto-scaling and Traffic Management provide high-performance, internationally-distributed web hosting scenarios. We've made it easier than ever to add background processing by adding Azure WebJobs as an option for web developers who need to add a middle tier. Along with staging and production deployment slots, and a rich SDK to enable service automation - a feature many software-as-a-service apps can use to automate their provisioning and deployment experiences - there's no better place than Microsoft Azure Web Sites to host your ASP.NET apps.

clip_image016

ASP.NET Publishing Explained

Sayed Hashimi

The Visual Studio publishing experience for ASP.NET projects has been refined over the past few years. In this talk we will go into detail covering all the different techniques to publish your asp.net apps. We will start in Visual Studio, and quickly move to the command line and continuous integration servers. Sayed will you how you can improve your publish process to target multiple environments and how to automate publishing from a CI server. We will also take a look at some of the unique publish workflows that Azure Web Sites supports.

clip_image017

ASP.NET Identity

Pranav Rastogi

ASP.NET Identity is a totally rewritten framework that brings the ASP.NET membership system into the modern era. ASP.NET Identity makes it easier to integrate different authentication systems such as local username, password as well as social logins such as Facebook, Twitter etc. It also gives you greater control over persisting data to your backend technology of choice. ASP.NET Identity is a game changer by bringing in more modern authentication systems such as Two-Factor Authentication. You can use ASP.NET Identity to secure Web Apps as well as Web APIs.

clip_image018

Dependency Injection and Testability in .NET

Mani Subramanian, Francis Cheung

Testability is more important than ever. With short ship cycles and the desire for continuous delivery, it is critical to quickly know if a modification has destabilized your code base. This session will enable you to use a dependency injection container of your choice to create testable code. We will examine tightly coupled code and what problems it causes and how DI can be used to avoid these problems. The Unity DI container will be used as the medium to understand the concepts.

clip_image019

SignalR

Damian Edwards

SignalR is one of the latest additions to the ASP.NET web stack. It provides real-time HTTP support for your web applications, but the good news is that SignalR is useful outside of a web browser, too. With a client API that's virtually identical in both the JavaScript and native .NET client implementations, developers only need to learn the SignalR abstraction itself to be able to write cross-platform real-time applications. This session will walk through the process of adding real-time functionality to your Windows 8 and Windows Phone 8 apps. We'll also take a look at the scale-out providers and OWIN hosting capabilities available in the latest release of SignalR.

clip_image020

ASP.NET vNext 101

Damian Edwards, David Fowler

ASP.NET vNext is a lean and composable framework for building web and cloud applications. ASP.NET vNext is fully open source and available on GitHub. ASP.NET vNext is currently in preview, and in this talk Fowler and Edwards will put it all into Context. vNext apps can use a cloud-optimized subset of the .NET framework. This subset of the framework is about 11 megabytes in size compared to 200 megabytes for the full framework, and is composed of a collection of NuGet packages. What does that mean for compatibility? When would you choose vNext and when would you not? You don't have to use Visual Studio to develop ASP.NET vNext applications. You can develop and run vNext on platforms that Visual Studio doesn't run on. But Visual Studio provides the best development experience, and we'll cover ASP.NET vNext both inside and outside the IDE.

We encourage you to share this content with your colleagues and friends, and remember that .NET Conf and all its content is free!


Sponsor: Thanks to friends at RayGun.io. I use their product and LOVE IT. Get notified of your software’s bugs as they happen! Raygun.io has error tracking solutions for every major programming language and platform - Start a free trial in under a minute!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

AppVeyor - A good continuous integration system is a joy to behold

May 30, '14 Comments [25] Posted in Learning .NET
Sponsored By

All my open source projects building in AppVeyorEpisode 4 (that's from 2006, people, over 8 years ago!) of the Hanselminutes Podcast was on (CI) Continuous Integration. I was deep into CI at a large bank and having a blast. It's just such a joy to have a reliable and repeatable build. Even more so if setting up that build is easy. A good CI build that includes build, test, and deploy means you don't have to fear your code.

Back in the day we used Batch Files, dreams, and wishes to setup our CI systems. Later we moved to CruiseControl.NET. Today we've got lots of amazing options, some we can download and setup inside the company, and some hosted that require virtually no effort at all!

Like many of you, I've got a number of utilities and open source projects up on GitHub. Mine are at http://github.com/shanselman, of course.

However, some are older, some aren't often built, and honestly I couldn't tell you if they build anymore. Sometimes I'll even accept a Pull Request (PR) without really confirming that there isn't a missing semicolon or a syntax error. Ya, I said it. I haven't been nailed yet, but we all do it, and we know it's bad. A reliable CI system that kicks off a build on a commit is the only way to be sure.

I decided to revisit AppVeyor as an option for my CI system. I looked at it 18 months ago and it was time to check it out again.

Just to be clear, they don't know I'm writing this, I don't know AppVeyor, and I don't do paid reviews. This is all my opinion.

AppVeyor says they "automate building, testing and deployment of .NET applications helping your team to focus on delivering great apps."

Cool. I like automate, I like building, testing and deploying. I'm lazy, as are all good developers, so automated all the things!

Their pricing is impressive. It's free for unlimited public repositories, which means I can setup a CI build for all my little utilities and open source projects on GitHub. However, their Pro and Premium options are extremely competitive when compared against running my own VM and CI system in Azure for a month. 

Setting Up

I don't want to gush, but it's simple and gorgeous. I signed up with my GitHub creds (and also added BitBucket as I have some stuff there as well) and made a new project. They automatically sucked in my repositories, as well as the ones I have access to from other organizations. I selected a small one, my WiFi Manager for Windows 8, and clicked New Build.

It cloned my project and started building within a minute. I got an immediate failure, which surprised me.

Specify the Project

I stared at the error for a moment. Ah, my folder has more than one project or solution. Odd, there's just one project. Ah! But there's a foo.csproj AND a foo.sln.

Intuitively I go to Settings | Build, and enter the name of my csproj file. By the time I come back to the dashboard it's building again.

The build dashboard is at the same time impressive and comforting. It looks like a command prompt in HTML and it updates on its own, so you never feel like you're waiting or wondering what's happening.

Build Success

Amazing, look at that. It worked. I can add tests, and identify artifacts (results of the build) and act on them.

Here's my xUnit tests running automatically and their results showing up in the dashboard. Magic.

Tests too!

Here's AppVeyor uploading a build artifact.

Found an artifact

One EXE as Artifact

Here I've added an artifact and can download it and run it right from the browser. If your artifacts are NuGet packages, they'll even give you a private NuGet feed for those artifacts that you can use in other projects or automate yourself!

Finally you can automate deployment to whatever environment you like. Push to Blob Storage (like I do for myEcho), push to a NuGet server, or Web Deploy.

Deploy Anywhere

Impressively, AppVeyor restores NuGet packages as well. It even built a two year old ASP.NET MVC repository of mine on the first try.

So my open source project builds, now what? Now I add a status badge to my project's ReadMe.md to let everyone who visits my GitHub repository that this is a healthy project that is building successfully!

Status Badges

It literally took me longer to write this blog post than it did for me to setup Continuous Integration for FOUR open source projects in AppVeyor. Literally about 15 minutes from start to finish.

AppVeyor is really impressive, fun to use, and "just works." It's a great example of Software as a Service and the kinds of software I talked about in my recent post We are abstracting on the shoulders of giants.

With cloud apps like AppVeyor for build/test/deploy, services like like RayGun.io for error management, Trello for products backlogs, FreshDesk for support tickets, there's just so many great choices for a software companies large and small. It's a great time to be writing software.

Related Links


Sponsor: Big thanks to Mindscape for joining us and sponsoring the blog feed this week! I discovered Raygun.io and started using it for my side project and I LOVE it. Get notified of your software’s bugs as they happen! Raygun.io has error tracking solutions for every major programming language and platform - Start a free trial in under a minute!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Fixing System.Core 2.0.5 FileLoadException, Portable Libraries and Windows XP support

May 8, '14 Comments [17] Posted in Bugs | Learning .NET | WPF
Sponsored By

Installing Windows XP to testMy buddy Greg and I are getting ready to launch our little side startup, and I was going through our product backlog. Our app consists of a global cloud service with Signalr, an iPhone app made with Xamarin tools, and a WPF app.

One of the items in our Trello backlog was "Support Windows XP. Gasp!"

I hadn't given this item much thought, but I figure it was worth a few hours look. If it was easy, why not, right?

Our WPF desktop application was written for .NET 4.5, which isn't supported on Windows XP.  I want to my app to support as basic and mainstream a .NET 4 installation as possible.

Could I change my app to target .NET 4 directly? I use the new async and await features extensively.

Well, of course, I remembered Microsoft released the Async Targeting Pack (Microsoft.Bcl.Async) through NuGet to do just this. In fact, if I was targeting .NET 3.5 I could use Omer Mor's AsyncBridge for .NET 3.5, so it's good that I have choices.

I changed my project to target .NET 4, rather than 4.5, installed these NuGets, and recompiled. No problem, right?

However, when I run my application on Windows XP it crashes immediately. Fortunately I have instrumented it with Raygun.io so all my crashes to to the cloud for analysis. It gives me this nice summary:

raygun.io is amazing 

Here's the important part:

FileLoadException: Could not load file or assembly 
'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
or one of its dependencies. The given assembly name or codebase was invalid.
(Exception from HRESULT: 0x80131047)

That's weird, I'm using .NET 4 which includes System.Core version 4.0. I can confirm what's in the GAC (Global Assembly Cache) with this command at the command line. Remember, your computer isn't a black box.

C:\>gacutil /l | find /i "system.core"
System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL

OK, so there isn't even a System.Core version 2.0.5 in the GAC. Turns out that System.Core 2.0.5 is the Portable Libraries version, meant to be used everywhere (that means, Silverlight, etc, everywhere) so they made the version number compatible.

Because we're building our iPhone app with Xamarin tools and we anticipate supporting other platforms, we use a Portable Library to share code. But, it seems that support for Portable Libraries were enabled on .NET 4 vanilla by the KB2468871 update.

I don't want to require any specific patch level or hotfixes. While this .NET 4 framework update was pushed to machines via Windows Update, for now I want to support the most basic install if I can. So if the issue is Portable Libraries (which I still want to use) then I'll want to bring those shared files in another way.

You can LINK source code in Visual Studio when you Add File by clicking the little dropdown and then Add as Link:

Adding source code as a Link within Visual Studio

Now my Messages.cs file is a link. See the little shortcut overlay in blue?

A linked file as a little overlay on the icon

I removed the project reference to the Portable Library for this WPF application and brought the code in this way. I'm still sharing core, but just not as a binary for this one application.

Recompile and redeploy and magically .NET 4 WPF application with async/await and MahApps.Metro styling starts up and runs wonderfully on this 12 year old OS with just .NET 4 installed.

For our application this means that my market just got opened up a little and now I can sell my product to the millions of pirated and forever unpatched Windows XP machines in the world. Which is a good thing.


Sponsor: Big thanks to Aspose for sponsoring the blog feed this week. Aspose.Total for .NET has all the APIs you need to create, manipulate and convert Microsoft Office documents and a host of other file formats in your applications. Curious? Start a free trial today.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

"It's just a software issue"- Edge.js brings Node and .NET together on three platforms

April 30, '14 Comments [44] Posted in Learning .NET | nodejs | Open Source
Sponsored By
.NET and node together on three platforms

There was an engineer I used to work with who always said "That's just a software issue." No matter how complex the issue, no matter how daunting, they were confident it could be solved with software.

.NET and C# and NuGet and the community have been making some amazing stuff in the last few years like ScriptCS, Chocolately, Boxstarter. Azure Websites now supports ASP.NET, sure, but also PHP, Python, Java (Tomcat or Jetty or your own container), and node.js. Getting these things to work together has been an interesting software issue. Apps can run side-by-side, but they can't really talk to each other in-process. (Mostly one just moves data between universes over JSON and HTTP when need-be.)

However, Tomasz Janczuk has been working on Edge.js (on Github) for a while now. I showed his work at jQuery Portland last year, but this week he's taking it to the next level. He is creating a wormhole between software universes.

Edge.js now lets you run node.js and .NET code in-process on Windows, Mac, and Linux.

The name is great. An edge connects two nodes, and Edge.js is that edge.

node and .NET connected by edge.js

Here's a node app hello world node app calling .NET. Don't sweat that the .NET code is tunneled inside a comment, this is the Hello World proof of concept.

var edge = require('edge');

var helloWorld = edge.func(function () {/*
async (input) => {
return ".NET Welcomes " + input.ToString();
}
*/});

helloWorld('JavaScript', function (error, result) {
if (error) throw error;
console.log(result);
});

Perhaps you have a bunch of CPU intensive work or algorithms in C#, but you've also got a node.js app that needs the result of that work. Edge can help with that.

You can bring in a CS or CSX file into node like this:

var myCSharpCode = edge.func(require('path').join(__dirname, 'myCSharpCode.csx'));

You can bring code from a .NET DLL into a node.js compiled as well.

var clrMethod = edge.func({
assemblyFile: 'My.Edge.Samples.dll',
typeName: 'Samples.FooBar.MyType',
methodName: 'MyMethod'
});

It's not a hack, it's a clear way to marshal between CLR threads and the V8 (the node Javascript engine) thread. It's also interesting from a comp-sci perspective as the CLR can have many threads and V8 has the one.

nodecsharp

Here's Tomasz's own words:

Edge.js provides an asynchronous, in-process mechanism for interoperability between Node.js and .NET.

You can use this mechanism to:

  • access MS SQL from Node.js using ADO.NET more...
  • use CLR multi-threading from Node.js for CPU intensive work more...
  • write native extensions to Node.js in C# instead of C/C++
  • intergate existing .NET components into Node.js applications

Read more about the background and motivations of the project here.

Now, you might ask yourself, what problem does Edge.js solve? The answer is in the Edge.js FAQ.

Go explore what you can do. Edge goes much further than just C# and Node. It works on Windows, OSX, and Ubuntu but you should just "npm install edge" as there's a node package available.

Have fun! You have a lot more power and flexibility than you think. It's just a software problem.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Cross-Platform Portable Class Libraries with .NET are Happening

July 9, '13 Comments [28] Posted in Learning .NET
Sponsored By

imagePortable Class Libraries are the Happy Little Feature that Could. They've been chugging along, doing their thing, and it's getting to the point where they are going to pop. That's pop in a good way.

If you're not writing .NET apps for more than one target, then you likely haven't bumped into them. However for those people who are writing .NET and want it to run on everything from Watches to Phones to Tablets to Xboxen to Desktops to the Cloud, they are enjoying what PCLs can offer.

There's still a few technical and legal challenges but I'm confident they'll be dealt with and we'll be able to create great binary libraries that can be used everywhere.

There's been a bunch of recent activity in the .NET community around Portable Class Libraries and cross platform .NET.  Overall, Portable Class Libraries are starting to see wider adoption, more open source libraries are being released with portable support, and the MVVM pattern is proving to be a great way to maximize code sharing in cross platform apps.

Portable Library Releases

First of all, there have been a bunch of new libraries released as PCLs recently.  Three of them are from GitHub's own Paul Betts:

  • Reactive UI – Reactive UI is an MVVM framework built on top of the Reactive ExtensionsVersion 5.0 was released last week, which is "totally Portable-Friendly", and supports the following platforms:
    • Xamarin.iOS
    • Xamarin.Android
    • Xamarin.Mac
    • .NET 4.5 (WPF)
    • Windows Phone 8
    • Windows Store Apps (WinRT)
  • Akavache - An asynchronous, persistent key-value store.  Version 3.0, which includes PCL support, was also released last week, and now "nearly all of your serialization and network access layer can be cross-platform." Akavache supports the same set of platforms as Reactive UI. This is a really amazing piece of software that deserves its own blog post. I'll do one soon.
  • Splat – "A library to make things cross-platform that should be." It has cross platform APIs for images and colors, with platform-specific extension methods to go back and forth between the platform-specific native types.  This looks like an elegant solution to the problem you run into if you want a portable ViewModel but you want to expose an image in it.

Next, Scott LoveGrove confessed:

I might be getting a little obsessed with PCLs at the moment. #IHaveAProblem (link).

Scott has released four portable libraries that help access web services:

  • Scoreoid Portable - A Portable Class Library that gives developers access to the Scoreoid scoring system.  The library provides a friendly .NET wrapper for the Scoreoid REST APIs, and uses our portable HttpClient NuGet package.
  • FanArt Portable - A Portable Class Library that gives developers access to the fanart.tv film, TV, and music image resources.  It also uses portable HttpClient.
  • Cineworld Portable - A Portable Class Library that gives developers access to the Cineworld film and cinema listings for the UK and Ireland.  It also uses portable HttpClient.
  • LiveSDKHelper - A helper library to more easily use the Microsoft Live SDK.  Contains strong types which the responses from the Live SDK can be deserialized into.

Another new portable library release is Budgie, a library for accessing Twitter. The .NET and Azure Teams have also released a PILE of Portable Libraries.

.NET Team:

Other teams:

Not to mention all these excellent Portable Libraries that you should be familiar with as well.

MVVM

IoC

Other

and of course, my favorite, the HttpClient, making HTTP calls easier, since, well, since a few months ago.

public static async Task<HttpResponseMessage> GetTheGoodStuff() 
{
var httpClient = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://hanselman.com/blog/");
var response = await httpClient.SendAsync(request);
return response;
}

//build/

One BUILD attendee took issue with the fact that speakers were telling people that you can't use platform specific functionality from a Portable Class Library, and wrote a blog post about how you can do this with abstraction and (preferably) dependency injection.

On at least 2 occasions recently, I have heard speakers tell their audience that you cannot reference a target-specific .NET library (such as a .NET Framework 4.5 library) from a Portable Class Library. While this is technically true, it doesn't tell nearly the whole story. Even though we can't reference target-specific libraries, we can still USE these libraries. We can call their methods and access their properties under the right circumstances. We can gain access to these libraries via an abstraction. My preferred method of doing this is...Dependency Injection.

Cross Platform .NET Coolness

There's lots of great examples of code reuse, like the podcast I did with the folks who wrote "Draw a Stickman EPIC." This app has 95%+ code reuse, all written in C# and is available in every App Store there is. Here's a few others.

Also, be sure to check out my talk from the Xamarin Evolve Conference - How C# Saved My Marriage. I talk about Portable Libraries in this talk. We'll hear more about Portable Libraries at the MonkeySpace Conference in Chicago in July of 2013.

clip_image001[6]

The British and Irish Lions app is a cross platform app targeting Windows Store, Windows Phone, iOS and Android. It uses Portable Class Libraries to share common code across platforms, Azure to host the services it uses, and the MvvmCross MVVM framework which I'm a huge fan of. The UK MSDN blog posted a case study of the development of the app, and there is also a prettier case study (with screenshots, infographics, etc) and a blog post by the developers.  In reference to Xamarin, MvvmCross, and Portable Class libraries, they state "Given the very short time-scales for the Lions apps (less than three months from the first line of code to our first release), we simply could not have delivered a rich native experience across all platforms without the common core."

Lions Rugby

Another cross platform app that uses MvvmCross is Aviva Drive.  This is an insurance company app that you can use to track your driving habits and hopefully get a discount on your insurance.  The app was featured in the Tech Ed Europe day 1 keynote (about 28:40 in), focusing on how it used Azure.

On the game side of things, Taptitude is a successful Windows Phone 7 game (or rather, a collection of minigames) which was ported to Windows Phone 8, Windows Store, iOS, and Android with the help of MonoGame and Xamarin.  The team reports that they have more than 99% shared code between all the platforms, which is especially important to them because they ship updates to the game about every week.

Xamarin

Scan.Xamarin.com

Xamarin has released an amazing .NET Mobility Scanner which analyzes code and tells you how "portable" it is and how compatible it will be with Xamarin.Android, Xamarin.iOS, Windows Phone, and Windows Store.  It lists all the APIs your code uses that aren't available on all the platforms, and an overall percentage of how portable your code is.  It's a very slick implementation and similar to what we've wanted to have for Portable Class Libraries.  Here's a sample report for the SignalR client library. The best part is that it does all this analysis without sending your code or binaries to Xamarin. It all happens in the browser. I love Xamarin.

Phil Haack (former PM for ASP.NET MVC and now working at GitHub) wrote a blog post titled Platform Limitations Harm .NET.  He argues that the Windows platform limitations should be removed from the EULAs for BCL NuGet packages.

I personally agree. Being able to reuse existing code, make portable libraries, and write apps that run in 64k or 64gigs is what makes .NET an interesting platform.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Page 1 of 30 in the Learning .NET category Next Page

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.