# Time Tortoise: Self-Hosting Cheat Sheet

This is one in a series of articles about Time Tortoise, a Universal Windows Platform app for planning and tracking your work schedule. For more on the development of this app and the ideas behind it, see my Time Tortoise category page.

It’s November, which means there are only two months left in my Time Tortoise project. That doesn’t mean I’ll stop working on it completely next year, but I won’t be writing about it much on this blog since I’ll be starting another project. To find out more about that project, look for the Subscribe option on this page.

With the main project wrapping up, it’s important to focus on the most important remaining work. A good way to do that is to self-host, or use the app for real time tracking. I wrote about the idea of self-hosting earlier this year. Today’s post is a cheat sheet for the self-hosting process.

## App Update Process

The way to self-host is to have two copies of the app: one in Visual Studio, for development, and the other installed like a normal app, for testing purposes. Fortunately, Windows 10 supports this scenario. Here are the steps to make it work.

Step 0: Prerequisite

To install an app from a local package instead of from the Windows Store, it’s necessary to enable your machine for side-loading apps.

Step 1: Remove the existing installation

The side-loading process won’t work if a copy of the app with the same version number is already installed. You’ll get the message: “Deployment failed with HRESULT: 0x80073CFB, The provided package is already installed, and reinstallation of the package was blocked.”

Since we don’t necessarily want to increment the app version if we’re just testing locally, here are the steps to remove the existing installation.

• In %UserProfile%\AppData\Local\Packages, find the package directory whose name starts with TimeTortoise_.
• Important: Under that package directory, find the LocalState directory and copy it to another location. This directory contains all of the Time Tortoise data, so it’s critical to have a backup before removing the app.
• In a PowerShell window, run Get-AppxPackage. This will output a list of all installed apps. Optional: use a parameter like Publisher to filter the list.
• Find the correct PackageFullName (e.g., TimeTortoise_1.0.0.0_x86__c8f44813jqyya) in the package list.
• Run Remove-AppxPackage [PackageFullName] to remove the package.

Step 2: Set the self-host package name

To keep the self-host version of Time Tortoise separate from the development version, we need two different package names. The package name that’s checked in with the source is the dev name (TimeTortoise-Dev), so before creating the self-host package, we need to temporarily change it to something different.

• Open TimeTortoise.sln.
• Right-click the TimeTortoise.UWP project, and select Properties.
• Click the Package Manifest… button.
• Click the Packaging tab.
• Change the package name from TimeTortoise-Dev to TimeTortoise.

Step 3: Create and install a new package

To self-host with the latest code, we need to create a new package. This can be done in Visual Studio.

• Right-click the TimeTortoise.UWP project, and select Store – Create App Packages.
• On the Create Your Packages page, answer No to the question Do you want to build packages to upload to the Windows Store? (We’re just self-hosting locally).
• Click Next.
• On the Select and Configure Packages page, leave the default values unchanged.
• Click Create.
• Open the package output directory (under TimeTortoise.UWP\AppPackages).
• Right-click on Add-AppDevPackage.ps1 and select Run with PowerShell.
• Switch the package name back to TimeTortoise. If you haven’t made any other manifest changes, you can just run git checkout -- TimeTortoise.UWP/Package.appxmanifest. Otherwise, edit it manually.

Step 4: Run the app

• In %UserProfile%\AppData\Local\Packages, find the package directory that was just created.
• Copy the contents of the LocalState backup (from Step 1) to the new LocalState directory.
• From the Windows Start menu, start the TimeTortoise app.

Step 5: Update the Time Tortoise Companion app

Time Tortoise Companion is a simple WPF (Classic Desktop) app that we can install using XCOPY deployment.

• If Time Tortoise Companion is running, exit the app using its context menu.
• If necessary, create an empty install directory for Time Tortoise Companion.
• Copy the contents of TimeTortoise.WPF\bin\Debug to the install directory.
• Run TimeTortoise.WPF.exe.