Deploying .NET App to Heroku Is Not Fun #dajsiepoznac

I’ve been building my wikibus.org code on AppVeyor, which is quite neat and used it to publish over WebDeploy to my VPS. Having recently watched a convincing presentation about Heroku on Wrocław .NET User Group I decided that maybe it will be an interesting experience.

First let’s find a mono buildpack

For those who don’t know Heroku, it’s a cloud hosting platform with support for anything really. It works by creating Ubuntu a deployment image called a dyno, which can be bootstrapped with any technology stack. The bootstrapping is done by setting up the process with a buildpack. There are a number of buildpacks available for a number of languages out of the box: Java, node.js, Python, Ruby, etc.

Unfortunately, for obvious reasons, there isn’t an official package for .NET or mono. An exception is a new ASP.NET 5. There are however quite a few buildpacks for .NET. This didn’t come as a surprise. After all the online community proves very resourceful :construction_worker:.

There is however comes another catch - I use Paket :sparkles: instead of NuGet Package Manager. I figured, meh, I’ll just fork a buildpack - preferably a one with recent mono, like version 4+ and just customize it to use Paket instead. So I went with a buildpack by Adam Burgess and adjusted the bash script…

Mono isn’t as ready as I’d hoped for :unamused:

And it doesn’t work. It seems that mono 4.2, or whatever version the buildpack currently uses has some issues with ssl certificates. I tried various remedies and I kept getting weird errors whenever Paket tried to do some network activity over https.

So I though, okay maybe I can try another buildpack, which uses an older version of mono. There is actually one already set up with Paket. I did some tweaks, so that it plays nicer with my repository, and now the solution won’t build! :rage:

LibGit2Sharp native libraries don’t work on mono:

Error executing task Zoltu.Versioning.GitTask: An exception was thrown by the type initializer for LibGit2Sharp.Core.NativeMethods

This one is Resourcer.Fody misbehaving:

Fody: Could not find a resource.

And I also had issues with referencing assemblies. Enough of that.

How about I deploy a pre-built package?

Who said I had to build the entire solution on Heroku? I already use AppVeyor to build an run test, so maybe I could just package all projects as nupkgs and deploy just a simple OWIN self-hosted application?

Stay tuned, I’ll come back when that’s ready :wink:

Comments