Monday, August 8, 2011

A better alternative to ILMerge

There's a great alternative to ILMerge available.

From the ILMerge homepage at MS Research:

A Great Alternative to using ILMerge

If you cannot use ILMerge because you are trying to merge WPF assemblies, then here is a great way for you to get the same effect, courtesy of Jeffrey Richter: embed the dlls you want to merge as resources and load them on demand! In many ways, this is a better technique than using ILMerge, so I strongly urge you to check it out, even if ILMerge is working for your scenario.

The alternative solution is part of Jeffrey Richter's book CLR via C# CLR via C#, Third Edition (Microsoft Press, 2010; ISBN: 9780735627048), you can read about it there:

http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx

How does it work?

It adds the required .DLLs as embedded resources to the primary .EXE file and uses AppDomain.AssemblyResolve to return the assemblies.

This is what Mike Barnett (the creator of ILMerge) says about it:

As the author of ILMerge, I think this is fantastic! If I had known about this, I never would have written ILMerge.

Many people have run into problems using ILMerge for WPF applications because WPF encodes assembly identities in binary resources that ILMerge is unable to modify. But this should work great for them.

Wednesday, August 3, 2011

Event Log Error: SideBySide (Event ID: 33)

Side By Side error is caused by a Security UpdateYou are seeing an error like this in the event log?

Activation context generation failed for "C:\Windows\system32\conhost.exe". Dependent Assembly Microsoft.Windows.SystemCompatible,processorArchitecture="amd64",publicKeyToken="6595b64144ccf1df",type="win32",version="6.0.7600.16816" could not be found. Please use sxstrace.exe for detailed diagnosis.

Cause: it's a known issue with a security update (deployed through Windows Update).

Try this: install Windows Server 2008 R2 Service Pack 1.

Monday, August 1, 2011

BOOTMGR is missing after Windows Server restart

After restarting a Windows Server I got this error message:

What an unplesant situation...

The following solution from the Binary War blog worked for me:

  1. Boot from Windows Server CD/DVD.
  2. Click Repair your computer
  3. Choose Command Prompt.
  4. Run x:\sources\recovery\StartRep.exe
  5. At the end of the repair process, the Wizard will ask to restart the machine (which will now hopefully boot normally).

Good luck!