Azure (WebSite-) deployment additional dependencies

If you want to publish your (Website-) project from within Visual Studio via WebDeploy you need to watch out that all files that you actually need on the server are included in the WebDeploy package. You’ll get problems if you dynamically load Assemblies via Assembly.LoadFile or Assembly.LoadFrom. If you haven’t referenced those Dlls or VS projects directly these assemblies won’t be included in the WebDeploy package and the WebSite won’t work in Azure.

To include files that are not directly referenced in your project edit the (WebProject) *.csproj-File in the following way:

<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets. -->
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
    <ItemGroup>
      <Content Include="[path to your dll]" /> <!-- the dll that should be included in the WebDeploy-package -->
    </ItemGroup>
  </Target>

Kinect.Reactive

Events in the .NET programming model really don’t have anything in common with what the Object Oriented paradigm has taught us. Personally I dislike events because they are not first class objects but some kind of background compiler voodoo.

When it comes to writing against an event driven API like the Kinect for Windows SDK you don’t have much of a choice but programming against those events. But wait, there is this wonderful ReactiveExtensions library that comes to the rescue. These classes and extension methods give you the possibility to easily wrap an event in an object and furthermore the library provides you with tons of handy methods that you don’t have to code yourself.

So I decided to write my own IObservable extension methods to extend the Kinect API with the ReactiveExtensions programming model.
Here are two methods to give you an idea of what I’m talking about:

public static IObservable<AllFramesReadyEventArgs> GetAllFramesReadyObservable(this KinectSensor kinectSensor)
{
   if(kinectSensor == null) throw new ArgumentNullException("kinectSensor");

   return Observable.FromEventPattern<AllFramesReadyEventArgs>(h => kinectSensor.AllFramesReady += h,
                                                               h => kinectSensor.AllFramesReady -= h)
                    .Select(e => e.EventArgs);
}

public static IObservable<ColorImageFrameReadyEventArgs> GetColorFrameReadyObservable(this KinectSensor kinectSensor)
{
   if (kinectSensor == null) throw new ArgumentNullException("kinectSensor");

   return Observable.FromEventPattern<ColorImageFrameReadyEventArgs>(
                                                           h => kinectSensor.ColorFrameReady += h,
                                                           h => kinectSensor.ColorFrameReady -= h)
                    .Select(e => e.EventArgs);
}
[...]

And so on…