Octopus Deploy with PublishedApplications
Tue, Apr 9 2013 11:38 AM

Normally, when you install Octopack using nuget, the contents of the OutDir (msbuild variable) will be put in the nuget package it creates for you. But when running in TFS build this will give you trouble as mentioned in http://help.octopusdeploy.com/discussions/problems/505-all-binaries-from-tfs-build-in-nuget-package

A solution was mentioned to use the PublishedApplications nuget package to build each project to its own directory and I blogged as much yesterday…. But this is just a half-baked solution; yes, each project is build to its own directory, but octopack still takes the output of the tfs binaries folder for the packages. I found a way around this and I will describe it here.

I had to edit the source for octopack. I changed the dll to determine how a web project is recognized. Normally it does this by looking for a 'web.config' file, now you set the attribute TreadEveryProjectAsApplication to 'true' of the CreateOctoPackPackage task which will make octopack always use the content of the OutDir as input for the package. (It will ignore the content files in the project directory.)

I also removed the line where it excluded the files in the _PublishedWebsites folder, because I explicitly need these files.

Added this PropertyGroup to the octopack.targets file:

<PropertyGroup>

      <OctoPackDirectoryToPack Condition="'$(ExeProjectOutputDir)' != ''">$(ExeProjectOutputDir)</OctoPackDirectoryToPack>

      <OctoPackDirectoryToPack Condition="'$(WebProjectOutputDir)' != ''">$(WebProjectOutputDir)</OctoPackDirectoryToPack>

    </PropertyGroup>

   

It will set the variable OctoPackDirectoryToPack to either ExeProjectOutputDir or WebProjectOutputDir. I then use that variable as input for the OutDir attribute of the CreateOctoPackPackage.

Download it here: http://bloggingabout.net/media/p/578418/download.aspx or check out the code at https://github.com/dmarckmann/OctoPack

 

Happy Coding!

PS. I later also created the property GetVersionFromAssemblyFileVersion (bool) if you want to get the version from the assemblyfileversion of the PrimaryOutputAssembly like we do. Download from github and build locally…

PublishedApplications sweetness for TFS Build
Mon, Apr 8 2013 4:46 PM

I just learned that there exists a nuget package that allows you to build your non-web projects to a '_PublishedApplications' directory just as your web projects are build to a '_PublishedWebsites' directory.

Check it out: http://www.nuget.org/packages/PublishedApplications/

From there on it's an easy ride to get your build to produce Octopus deploy packages. You can read about it here: http://help.octopusdeploy.com/discussions/problems/505-all-binaries-from-tfs-build-in-nuget-package

If you want to know all about setting up TFS build for Octopus deploy, check this great walkthrough: http://octopusdeploy.com/blog/automated-deployment-with-tfspreview-octopack-myget

 

Happy Coding!

From ‘A-ha’ to ‘Ka-Ching’ with Sound Of Data
Thu, Mar 21 2013 9:45 AM

This post will be posted here and on the site of Sound of Data as well (http://soundofdata.nl/en/nieuws)

As of february 25th I started as Senior Developer at Sound of Data. For those who do not know me I'll shortly introduce myself.

I am 37 years old and I live in Goedereede-Havenhoofd. (That's here). Writing code has always been a hobby and 14 years ago I managed to turn my hobby into work and I've been hobbying ever since.

After 7,5 years working for TellUs, leader in online (sales) lead generation, it was time for a change. I was lucky to be contacted by Sound of Data because of my affinity with CQRS and Event Sourcing.

Their entire platform has been built on this architectural design pattern and they could do with an extra senior developer. I soon learned that their implementation of CQRS & ES is okay, but not yet fully complete. I hope to be able to lend a hand in completing the implementation. Than we can enjoy all the benefits of this pattern.

This isn't my first priority though. I saw that SOD has some issues where it comes to deployment, so I made it my mission to get some Application Lifecycle Management in place and take the first steps towards Continuous Delivery. The idea of this practice is to make the time between 'A-ha' (the idea) and 'Ka-ching' (the release to market) as small as possible by automating and standardizing releases. This will help us bringing our customers closer to their customers and bring us one step closer to world domination in that area.

   

Happy coding!

 

Quick install of tools using Chocolatey
Thu, Mar 21 2013 9:37 AM

I got my new laptop today… decided to spend an hour or so to get an easy install working. Using Chocolatey (http://chocolatey.org) that should be easy.

It is, but it is not straightforward. You can't create a simple batchfile like this:

cinst notepadplusplus

cinst fiddler

 

The command window will exit after installing notepad++.  A quick search revealed what I should have realized up front. Chocolatey uses nuget and therefor we can use a local packages.config file to get and install all packages. So now my script looks like this:

::Ensure we have elevated permissions

@reg add HKLM\Software\Microsoft\DevDiv\0b3d680166a14e50a8c8e2ed060d8d90 /v Elevated /t REG_DWORD /d 1 /f > nul 2>&1

@if /i "%errorlevel%"=="1" echo Error: elevation required. &exit /b 740

@reg delete HKLM\Software\Microsoft\DevDiv\0b3d680166a14e50a8c8e2ed060d8d90 /va /f > nul 2>&1

 

::Install Chocolatey

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

::Start installing packages

cinst packages.config

 

And here is the contents of my packages.config:

<?xml version="1.0" encoding="utf-8"?>

<packages>

    <package id="VirtualCloneDrive" />

     <package id="notepadplusplus" />

    <package id="FoxitReader" />

    <package id="imgburn" />

    <package id="7zip" />

    <package id="ilspy" />

    <package id="tortoisegit" />

    <package id="tortoisesvn" />

    <package id="tortoisehg" />

    <package id="expresso" />

    <package id="virtualbox" />

    <package id="KeePass" />

    <package id="Paint.NET" />

    <package id="rabbitmq" />

    <package id="steam" />

    <package id="vlc" />

    <package id="fiddler" />

    <package id="baretail" />

    <package id="linqpad4" />

    <package id="tweetdeck" />

    <package id="teamviewer" />

    <package id="Teamspeak3" />

    <package id="skype" />

    <package id="SkyDrive" />

    <package id="ransack" />

</packages>

 

So I'm quickly set up to do some happy coding!

DEP0700 : Registration of the app failed. Rejecting a request to register from because the files are on a network share.
Mon, Mar 4 2013 1:12 PM

I wanted to run my app an my VM, but got the above error…

A quick search on google lead me to this thread on DevCenter: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/3fc1f3cf-2d8b-4dee-a348-40d0bf2c3c66/

The answer there is spot on!

I chose option 1, setting my debug option to Remote and setting by Debug option to localhost. Works like a charm! Thanks Gearard Boland for providing us with the answer!

Happy coding!

Installing Win8 in VHD for use with Virtualbox using install.WIM
Mon, Mar 4 2013 11:52 AM

I found this wonderful solution for installing Windows 8 on a VHD for dual-boot using the imagex tool. You can read about it here: http://blogs.technet.com/b/haroldwong/archive/2012/08/18/how-to-create-windows-8-vhd-for-boot-to-vhd-using-simple-easy-to-follow-steps.aspx

Problem I experienced now was that I needed a VitualBox Windows 8 machine and there it did not work. I got the message ‘BOOT FAILURE’ after trying to start up that installation.

I ended up using WIM2VHD with the /HyperV switch to prep the VHD for Hyper-V. Then I created a new VirtualBox machine with the vhd. I removed the SATA controller entirely and added new IDE harddisk using the vhd.

And now I am running Windows 8 in VirtualBox!

 

Happy coding!

In the Pocket – Users
Sat, Feb 23 2013 11:02 PM

 

I got a mail today, from a user … yes, really… A real user! He likes my app. And I like him for using it! I aim to please.

He had 2 feature requests. I love that sort of thing. Yesterday I didn't really know what to do when sitting behind my pc. I wanted to continue working on In the Pocket, but I lacked a sense of purpose. And now I have no less than 2 features to build.

After nearly 100 downloads, I decided to create a uservoice site for In the Pocket. Dennis (http://bloggingabout.net/blogs/dennis) suggested it. This was just what I needed, a way to know what to do next!

So if you have a suggestion for In the Pocket: please register it at http://inthepocket.uservoice.com or go there to vote for the next features to build.

If you found a bug or have some other issue with it, send an email to tickets@inthepocket.uservoice.com.

Now that I know what to do, let's get back to some happy coding!

 

  

by Dries Marckmann | with no comments
Filed under:
In The Pocket – Open work list
Fri, Feb 22 2013 9:19 AM

I decided to make my Trello work list for In The Pocket public, but read-only. You can follow the progress of In The Pocket here:

https://trello.com/board/in-the-pocket/50dcd3b6b3ac9e631b000707

Windows 8 – Html to RichTextBox Content
Thu, Feb 21 2013 9:55 PM

As I explained in my last posts (here and here) I want to use Diffbot to implement my offline reading feature. I want the text to show up looking as close to the real website as I can. This can be done with the RichTextBlock control. This can implement a very limited set of xaml elements. Read about it on http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.richtextblock.

Luckily DiffBot can send me the text in html, so the style isn't lost. All I needed is a way to convert Html to Xaml. If you search NuGet for 'RichTextBlock' you get 2 results: RichTextBlock.Html2Xaml and WinRT Html2Xaml Converter . I tried them both, but the first uses an xslt template for parsing the html and that only works if the html can be processed as xml. If only every website was this tidy… So I ended up using the last one that uses HtmlAgilityPack to parse the html.

WinRT.Html2Xaml

I like the general idea of this project. Check out the code on https://winrthtml2xaml.codeplex.com/. Here's how it works:

There is an attached property for the Html so we can bind a string in a class called Properties. Whenever the Html changes the HtmlChanged eventhandler is called. This method uses the converter to convert html to xaml, set this in a new RichTextBlock and then moves all the blocks from the new RichTextBlock into the existing one. Works like a charm.

The Html2XamlConverter is a static class with 1 public method: Convert2Xaml(string htmlString) (it also has an overload where you can specify extra attributes) which is called from the HtmlChanged eventHandler. It uses TagDefinitions to specify how a translation between html and xaml tags should be made.

Downside

Unfortunately, this package does not support parsing img tags to Images and it provided no good way of extending the processing to my needs. The Html2XamlConverter is a static class with a fixed set of TagDefinitions, there is no way to get in between.

Nothing to do but fork I guess.

Fixing extensibility

First of all, to allow dependency the static Html2XamlConverter must be changed to a non-static class. Secondly, I added an extra attached property Converter in the Properties class to allow setting converter in xaml (this has to be a resource though. Here's how you use it:

<Page.Resources>

        <common:MyHtml2XamlConverter x:Key="MyConverter" />

    </Page.Resources>

<RichTextBlock
h2xaml:Properties.Html="{Binding Text}"
h2xaml:Properties.Converter="{StaticResource MyConverter}" />

I can now specify which Converter I want to use. I can even bind it if I so want.

So I forked the code, refactored and will do a pull request soon. In the meanwhile get the code here: http://winrthtml2xaml.codeplex.com/SourceControl/network/forks/dmarckmann/extendableHtml2Xaml

Accidentally, I added support for img tag parsing also.

Here's a little sample of a converter that will parse pre tags to allow the right view of c# code:

public class MyHtml2XamlConverter : Html2XamlConverter

    {

        public MyHtml2XamlConverter()

            : base()

        {

            tags.Add("pre", new TagDefinition(parsePre) { MustBeTop = true });

        }

 

        private void parsePre(StringBuilder xamlString, HtmlNode node, bool isTop)

        {

            xamlString.Append("<Span FontFamily=\"Consolas\" FontSize=\"14\">");

            xamlString.Append(node.InnerText.Replace("\n", "<LineBreak/>").Replace(" ", "<Run Text=\" \"/>"));

            xamlString.Append("</Span>");

        }

    }

 

Now we'll have to wait for someone to make us a converter that will parse pre tags with c# color coding… (Do I hear 'challenge accepted!'? Anyone?)

 

Happy coding!

In the Pocket - Using DiffBot
Thu, Feb 21 2013 2:59 PM

In order to be able to read content offline, I decided to implement DiffBot rather than apply for use of the Article View API of Pocket itself.

DiffBot is just awesome. It is so accurate in picking the main content. Pocket Article View API is sometimes just plain wrong. Look at Udi Dahans blog for example:

This is what Pocket makes of it:

That is not the main content at all, it is the sidebar! DiffBot however, is absolutely spot on:

Basically this is because DiffBot approaches the webpages visually. It 'looks' at pages the way humans do.

And they have more than just the article API! Learn more on how DiffBot works and what it can do for you:

And DiffBot is also really easy to implement: just check out the API documentation here. You can also take it for a spin there!

Happy coding!

Status update for In the Pocket
Thu, Feb 21 2013 1:55 PM

I am still working on my app In the Pocket, but my focus is now on getting my paid version out.

The paid version of In The Pocket (release 1) will add the following features to In The Pocket Free:

  • Being able to save articles locally (implemented using DiffBot service)
  • Queuing added items even when you have no internet
  • Marking items as read even when you have no internet
  • Being able to mark many items as read from the main screen
  • Being able to read items that have been archived (Marked as read)

You may wander, why I want to have all these offline features. The reason is simple and I will explain below.

Although the moments are scarce, we are still not always connected to the internet with our tablet or laptop. When we are on the move, we have a phone that is still connected, our other devices are usually not. You can set up Connection sharing to have a wifi connection always, but your data plan would have to be a big one and your bill will be huge. For most people this is not an option.

So better to plan for an 'occasionally connected' application, but that means you will have to have all the features available that you would have when you are online.

Windows 8 RT & Caliburn.Micro - Being a share source
Mon, Feb 11 2013 1:48 PM

If you want to know how to share be a share target rather than the source, go here.

Being is the source of the share action is simple.

In the ViewModel where you have the content you want to share, add this:

protected override void OnActivate()

{

base.OnActivate();

DataTransferManager.GetForCurrentView().DataRequested += OnDataRequested;

}

protected override void OnDeactivate(bool close)

{

base.OnDeactivate(close);

DataTransferManager.GetForCurrentView().DataRequested -= OnDataRequested;

}

protected void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)

{

var request = args.Request;

 

var requestData = request.Data;

requestData.Properties.Title = Title;

requestData.Properties.Description = Description;

requestData.SetUri(new Uri(Url));

}

 

Basically, we subscribe to the DataRequested event and fill the Request that comes with the event arguments with the data we want to share.

Easy!

Windows 8 – NuGet: You are trying to install this package into a project that targets '.NETCore,Version=v4.5'
Tue, Feb 5 2013 9:56 AM

Today, after installing Visual Studio Express 2012 for Windows 8 on my home laptop, I experienced something I haven't since I started developing. I got this message when trying to install Caliburn.Micro in a new project:

You are trying to install this package into a project that targets '.NETCore,Version=v4.5', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.

I remember having to Google for a while before finding the answer, so here it is: It's to do with the version of NuGet Package Manager you have installed. NuGet 2.0 or earlier expect the 'winRT45' or 'NETCore45' packages while as of version 2.1 NuGet expects one of the following: Windows, Windows8, win, win8.

More information can be found here: http://docs.nuget.org/docs/release-notes/nuget-2.1#Targeting_Windows_8_and_Windows_Phone_8_Projects

Installing your app on your Windows RT device
Tue, Jan 29 2013 10:33 AM

Alright… so my app is almost finished and I want to install it for real on my Surface tablet. How do I do that? Is it possible?

Yes it is.

NB: People, seems like I was not entirely accurate. Before you can install the package this way, you need a developer license for your Win RT device. You can get one by installing the remote tools for VS2012 on your Surface (http://go.microsoft.com/?linkid=9810474) and remote debug at least one app you created yourself.

 

It involves 4 steps:

  1. Create the app packages
  2. Get files to your tablet
  3. Install the certificate included in the package on your tablet
  4. Install the app on your device

Create the app package

To do this you can navigate to Project > Store > Create App Packages...

You will be asked whether you have a Windows store account, just select 'no' and continue. Now you will be asked for the details of your package like the version and the architecture.

Modify as needed or just click 'Create'. After that you will be shown a window with a link to the outputpath of the package and the possibility to start the Windows App Certification Kit. Klik on the first link to be taken to your package and then click 'OK'.

You'll find an .appxupload file and a folder with more files. The .appxupload file is just a zip (if you rename you can open it). The folder contain the interesting documents though…

Getting the files on your tablet

There is one awesome way to get the files on your tablet: SkyDrive! Of course mail, usb or similar will also work.

Move these files to your device: the .appx file and the certificate. Optionally you could include the .appxsym file to include the symbols. BTW both the appx and the appxsym files are zip files.

I placed the files in my SkyDrive and downloaded them to my desktop on my tablet.

Install the certificate on your tablet

When I open the certificate file on my tablet I get option to install the certificate. Now, you should install it to the local machine, make sure the certificate is installed in the 'Trusted Root Certification Authorities' store (NOT automatically selected).

Now this step is done… easy right?! On to the files stage: installing your app…

Install the app on your device

Open a powershell window in administrator mode. (Open start, search Powershell, select by dragging down, select 'Run as Administrator')

In the powershell console, navigate to the place where your application is. (Hint: 'cd' for change directory works fine…)

Now type 'Add-' and tab to let powershell finish the command. It now says: Add-AppxPackage

Just specify the appx filename: Add-AppxPackage .\<filename>.appx

Hit enter. The app should now install.

 

NB: People, seems like I was not entirely accurate. Before you can install the package this way, you need a developer license for your Win RT device. You can get one by installing the remote tools for VS2012 on your Surface (http://go.microsoft.com/?linkid=9810474) and remote debug at least one app you created yourself.

 

Happy coding! And running, I guess…

 

by Dries Marckmann | with no comments
Filed under: ,
Windows 8 –Live tiles
Tue, Jan 22 2013 6:37 AM

My friend Pascal (http://www.pazquality.com/) is also working on a windows 8 application. He was having trouble with getting the Live tiles to work so I volunteered to find out how to cycle to a couple of tiles and keep cycling between them.

Well, it's surprisingly simple… Here's the code that I wrote in the constructor of the App:

//I installed the following nuget package: http://nuget.org/packages/NotificationsExtensions.WinRT

//This will give you access to the Templates without having to go through the xml...

 

//Add to Tiles

var x1 = TileContentFactory.CreateTileSquareText01();

x1.TextHeading.Text = "Text 1";

var x2 = TileContentFactory.CreateTileSquareText01();

x2.TextHeading.Text = "Text 2";

 

//Make ScheduledTileNotifications out of them with a due date of 10 and 20 seconds from now...

ScheduledTileNotification n1 = new ScheduledTileNotification(

x1.GetXml(), new DateTimeOffset(DateTime.Now.AddSeconds(10)));

ScheduledTileNotification n2 = new ScheduledTileNotification(

x2.GetXml(), new DateTimeOffset(DateTime.Now.AddSeconds(20)));

 

//Initialize the TileUpdater

var m = TileUpdateManager.CreateTileUpdaterForApplication();

 

//Enable Queuing (this is what makes it cycle....)

m.EnableNotificationQueue(true);

 

//Add the ScheduledTileNotifications to the schedule...

m.AddToSchedule(n1);

m.AddToSchedule(n2);

 

The tile is now cycling through these 2 notifications…

Happy coding, pazzie!

More Posts Next page »