The exact error is as follows
Could not load file or assembly 'Microsoft.SqlServer.Replication, Version=126.96.36.199, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I've recently started working on this project again after a two month move to another project. It worked perfectly before, and I've double checked all the references.
I've found the solution. I've recently upgraded my machine to Windows 2008 Server 64-bit. The SqlServer.Replication namespace was written for 32-bit platforms. All I needed to do to get it running again was to set the Target Platform in the Project Build Properties to X86.
The answer by baldy below is correct, but you may also need to enable 32-bit applications in your AppPool.
Whilst setting up an application to run on my local machine (running Vista 64bit) I encountered this error:
Could not load file or assembly
ChilkatDotNet2or one of its dependencies. An attempt was made to load a program with an incorrect format.
Obviously, the application uses ChilKat components, but it would seem that the version we are using, is only the 32bit version.
To resolve this error, I set my app pool in IIS to allow 32bit applications. Open up IIS Manager, right click on the app pool, and select Advanced Settings (See below)
Then set "Enable 32-bit Applications" to True.