Debugging Cake add-ins using Visual Studio

Recently I wanted to (finally) automate builds & submissions for all my UWP apps. Deploying a UWP app manually is a long process since it always creates a full .NET native build. This is only required for the certification kit and the store only uses the MSIL package. Before we dive into automating builds for UWP apps, let’s stay focused on debugging Cake extensions first.

The Cake extension I was working on is Cake.WindowsAppStore. It can be used to automatically create submissions for Windows Store apps. Debugging Cake add-ins is a bit of a thing, and there are several ways to do it. In this post I’ll describe what I think is the easiest way to debug Cake add-ins.

Step 1: Copy extension to the add-in directory in the cake script

The first thing we must do is to make sure that Cake uses the latest debug build of the add-in we want to debug. We can do this by creating this post-build step for the add-in project in Visual Studio:

xcopy /s /f /y “C:\Source\Cake.WindowsAppStore\src\Cake.WindowsAppStore\bin\Debug\net45\*” “C:\Source\MyApp\tools\Addins\Cake.WindowsAppStore\lib\net45\”

Note 1: this is stored in the csproj file and will be used for all users

Note 2: I would normally have used the build macros, but they don’t work (yet)

Step 2: Set the debug options to run Cake directly

In Visual Studio, go to the Project Properties and select the Debug tab:

1. Set Launch to Executable

2. Set Executable to C:\Source\MyProject\tools\Cake\Cake.exe

3. Set Application Arguments to build.cake -target=Deploy (where target is obviously the Cake target you want to run)

4. Set Working Directory to the project directory you want to run the Cake script against, e.g. C:\Source\MyProject\

Note that this is a user-specific setting so will only work on your machine

Below is a screenshot of the final result:


Step 3: Enjoy your debugging experience


Discovering open source WPF components – Orc.Snapshots

In the discovering open source WPF components series, I will look into useful open source components that can be used to create WPF apps. This weeks component is Orc.Snapshots.

Snapshots are like save games. They represent a set of data and/or values from a specific moment in time in an application. Using snapshots allows an application (and thus eventually the end-user) to store data (in memory, in a file or any in other persistence tech) which can later be retrieved. The advantage of using this library is that it will zip all the data into a single snapshot package

Whenever a snapshot is created, the SnapshotManager will:

  1. Create a zip memory stream
  2. For each provider, it will ask the provider to fill up a memory stream which is stored as a separate file
  3. Persist the snapshot memory stream to the required persistence store

Below is an animated gif of the example app that is available in the component repository:


The library makes it super convenient to add custom data to a snapshot. Just create a provider and register it in the manager and you’re done. This way you can even store (multiple) files (representing a specific moment in time) in a snapshot. Then the users can restore the snapshots whenever they want to.

Splitting up OneDrive folders to separate disks

Disclaimer: only follow this guide if you have a backup of your data, don’t come to me telling you lost all data and didn’t make a backup before following this guide. Use at your own risk!

I am using OneDrive for a lot of things: my documents, my photos, my videos, etc. On my main pc, I have 2 disks:

  • C:\ => a combination 3 SSD’s in RAID0 to maximize performance for the OS and apps, available space is 300 GB
  • D:\ => A regular disk to store files that don’t need lots of activity, available space is 1 TB

Since I like to take RAW photos, my OneDrive usage looks like this:

  • Documents (5.88 GB)
  • Pictures (177 GB)
  • Videos (10 GB)

This means that after installing a few games (that also take quite some space) on the C drive, I am basically out of luck because to sync my OneDrive stuff, I would need more than what the C drive has to offer.

Possible solutions I tried in the past

The first thing I did was to uninstall a few games, but this was just a temporary solution because eventually the Pictures folder became bigger and bigger (Lumia 950XL shooting RAW can take quite some space).

The second thing I did was to move all the files to the D drive because it had much more space. But boy my documents (which I am working in daily) were… so… slow.

The third option I tried was not syncing the Pictures folder to this main PC at all. But then I wanted to edit my photos in Lightroom and got stuck again

The solution – directory symlinks

The something came to mind: why not try and see if we can use symlinks to store the Pictures and Videos on the D drive while keeping the rest of the stuff on the C drive. It was actually simpler than I thought. In order to move some OneDrive folders to a separate disk, use the following simple guide to do so.

  1. Stop OneDrive so it doesn’t sync anything
  2. Move both the Pictures and Videos folder (or any folder you’d like to move to a different disk) to a different drive (in my case D), so I ended up with:
    1. D:\Pictures
    2. D:\Videos
  3. Open a command prompt window (in administrator mode) and navigate to C:\Users\[yourname]\OneDrive
  4. Use the following command to create a symlink for a directory:

    symblink /D [name] [directory]

    In my case these are the commands:

    1. symlink /D Pictures D:\Pictures
    2. symlink /D Videos D:\Videos
  5. You will see the directories “appear” again in the OneDrive folder. Now you can start OneDrive and your data is ready to be synchronized (it should already be synchronized if you haven’t changed any files from the moment you performance step 1)


This way I can store my pictures, which I don’t edit that often, on a separate, very large and cheap drive while keeping my documents on a super fast drive and still sync everything with OneDrive.