ILRepack – E Pluribus Unum: One assembly from many

Sometimes it is just much easier to deploy a single assembly that includes all dependencies.  ILRepack and ILRepack.MSBuild.Task will do just that for you.  Since I like to have Visual Studio and my build environment do this for me, I went with ILRepack.MSBuild.Task.

The Sample

In order to showcase packing an assembly into my program, first I need a program that has a dependency.  I decided to go with a simple console app that has a dependency on the Humanizer NuGet package to tell you how long you have to wait until your birthday. 

Usage:   repack [date]
  Prints how long it is until your birthday.
  If you don't supply your birthday, it uses mine.

23 weeks until your birthday

I created a new console project in Visual Studio and named it Repack.  I then included the Humanizer DLL using the NuGet package manager. 

You can find the source code on github.

Using ILRepack

All you need to do is add the following snippet at the end of your .csproj file.  To do this, you can open up the .csproj file in notepad or your favorite text editor.

<Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'">

  <InputAssemblies Include="$(OutputPath)\$(AssemblyName).exe" />
  <InputAssemblies Include="$(OutputPath)\*.dll" />


Because we name the target “AfterBuild”, this code will automatically be run after msbuild or Visual Studio builds our project.  Setting the condition ensures that this will only run when we are in release mode.  You can definitely run this on debug builds, but it’s less likely that you’d want to.

The ItemGroup specifies lets us create a list of assemblies to include in the package.  The first assembly should be your assembly.  In my example it will be my executable file “Repack.exe”.  Next, I include all the DLLs in the output directory.  This way, if I add a new dependency later, it will be included automatically.

Note that the order does matter.  You will want to put the .exe first in this list.

Next all we need to do is call ILRepack.  You can specify the output file to be anywhere you like, but in this example I overwrite the existing Repack.exe with the packed version.

Once you rebuild your project (in release mode), you can copy the EXE anywhere you want and it will run. 


ILRepack.MSBuild.Task let’s you package DLL’s into your EXE file so you can copy just the executable anywhere and not have to worry about deploying the dependencies as well.

Full sample code can be found on github.

Happy coding.

Convert Azure Publish Profiles to FileZilla config files

Occasionally I need to FTP into one of my Azure websites.  Sometimes it’s to look at the logs; other times to upload a few files.  Just about every time I go to do this, I realize that I don’t know the credentials.  So I go and download the publish profile and open it up in my favorite text editor to get the FTP information and manually enter that in FileZilla.

I quickly became tired of doing this, so I wrote a console app that will do it for me.  The source code and executable are available on my GitHub.


  1. Download your publish profile
  2. Run the command line tool
  3. Import the config file to FileZilla

Download your publish profile

Log on to the Azure management portal for the website you want to FTP into.  On the right side of the dashboard page you will see an option to “Download the publish profile.”  Click it and you’re on your way.


When downloaded the file will look something like this:

<?xml version="1.0" encoding="utf-8" ?>
    profileName="TestSite - Web Deploy"
    userPWD="test password"
    profileName="TestSite - FTP"
    userPWD="test password"

Obviously, all the pertinent connection information has been scrubbed clean.  But you get the idea.

Run the command line tool

Next thing you need to do is run pubToFz.exe to convert the publish profile into a format that FileZilla understands.  Assuming the default download location, the command would look like this:

pubToFz %home%\downloads\testSite.publishProfile

By default, the tool creates an file named FileZilla.xml in the current directory.  The file will look something like this.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
      <Pass encoding="base64">base 64 encoded test password</Pass>
      <Comments />
      <LocalDir />
      <RemoteDir />

Again, this was scrubbed clean.

Import the config file to FileZilla

Now all you have to do is open up FileZilla and import the config file that you just saved.