Navigation


contactdonateaop.net



PostSharp and ILMerge

posted by gael    Thursday, July 24th, 2008 at 9:40 am

Combining PostSharp with ILMerge seems a recurring demand. Indeed, many developers don’t welcome the multiplication of dependent assemblies as PostSharp.Public.dll and PostSharp.Laos.dll, and ILMerge seems the dreamed solution to that. Unfortunately, it will work only in rare cases.

The Simple Case

Say you have an assembly named MyProgram.exe with aspects defined in this assembly. The application is formed of the following assemblies:

PostSharp.Public.dll
PostSharp.Laos.dll
MyProgram.exe

In this particular case, it is valid to merge all three assemblies into a new assembly equally named MyProgram.exe.

However, if you modify the name of the merged assembly, it will cease to work.

What’s Wrong?

Remember that the aspects are serialized into the assembly. It uses the BinaryFormatter to do the job. Unfortunately for our purpose, this formatter stores the full type name of aspects, including the assembly name. So when you rename the assembly, you break the link between the aspect serialization and the underlying types, and you get an exception during deserialization.

The same occurs when you have aspects in one of the dependencies you merge. Say your program references MyLibrary.dll, whose some classes have been enhanced by PostSharp Laos. If you merge it into MyProgram.exe, the serialization of aspects previously defined in MyLibrary.dll will be broken.

Possible Solution

The problem clearly lays in the use of the BinaryFormatter to do the job. We could eventually use another serializer that does not store the full type name.

This feature (pluggable serializers) was actually present in former builds of what is now PostSharp 1.5, but I have removed the feature because it became useless. If there is some interest, I could restore it. It very much depends on the feedback I will get.

How is this a critical feature for you?

 

Happy PostSharping,

~Gael

7 Comments »

Comment by Daniel — July 24, 2008 @ 10:58 am

We are using PostSharp only in Web Applications, so we do not have to take care about the number or names of the assemblies…

Comment by Genesys — July 24, 2008 @ 4:54 pm

We currently use it to build WinForms applications. Additionally we use PostBuild to bundle the application into a single exe. Ideally we would like to be able to rename the exe. While I wouldn’t say this feature is critical, it would eliminate a worry.

Comment by Gael Fraiteur — July 24, 2008 @ 5:32 pm

Of course, all I said here about limitations due to assembly renaming are also valid with type renamings, as is often the result of obsfuscation.

Comment by pej — July 24, 2008 @ 6:10 pm

Thanks a lot for bringing this on the table, since I have been requesting it on the forums, I will give the reasons here as well :-)

First of all, it’s really cool to be able to deploy a single .exe file instead of mony files on the drive (à la .app of Mac OS X).

But more importantly for me: I build libraries for my clients and it’s a lot easier to deliver a single and consistent file to my clients, rather than them start asking me what these dependencies are, why they need them, why I used them, and also avoid them to have to add many dependencies to their own projects.

Comment by Miguel Madero — July 24, 2008 @ 9:30 pm

Gael,

For debugging purposes we can work the way we use to and to release the product simply, disable PostSharp do the merge then do the PostSharp tasks on the merged assemblies that way the BinarySerializer will reference the correct assemblies. That could do the work and there’s no need to change the serializer to a probably less efficient one.

Comment by Gael Fraiteur — July 25, 2008 @ 8:52 am

Miguel,

You could not merge before, because then PostSharp would not recognize its dependencies (PostSharp.Public and PostSharp.Laos).

Comment by Miguel Madero — July 25, 2008 @ 4:29 pm

:( Too bad this wouldnt work, but I’m glad you found the solution….

TrackBack URL

Leave a comment

Download Adobe InDesign CS2 v4.0 OEM Cheap OEM Software. Buy and download oem Adobe, oem Autodesk, oem Macromedia, oem Microsoft at SoftwareVending.com Download Adobe Acrobat 7.0 Pro OEMDownload Adobe Contribute CS3 OEM Online Casinogulfstream casino hollywood gun lake casino updated information hammond indiana casino hampton beach casino hampton nh Download Microsoft Windows Millennium Edition OEMDownload Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEM Download Adobe Acrobat 3D OEM Download Adobe Photoshop CS3 French OEMDownload Adobe Dreamweaver CS3 OEM Download Adobe Acrobat 6 professional OEM Download Adobe Premiere Elements 3.0 OEMDownload Adobe Premiere Pro 7 OEM Download Adobe Acrobat 7.0 Pro OEM Download Adobe Streamline 4.0 OEMDownload Adobe Contribute CS3 OEM Download Adobe Acrobat 8 OEM Download Microsoft Windows XP Professional SP2 OEMDownload Adobe InDesign CS2 v4.0 OEM Download Adobe Acrobat Distiller 6 OEM Download Adobe Acrobat 7.0 Pro OEMDownload Adobe Acrobat 6 professional OEM Download Adobe After Effects 7 OEM Download Adobe Type Manager Deluxe 4.1 OEMDownload Adobe Photoshop CS3 French OEM Download Adobe After Effects CS3 OEM Download Microsoft Windows Server 2008 OEMDownload Adobe Acrobat 3D OEM Download Adobe Atmosphere 1.0 OEM Download Adobe Photoshop CS2 + Image ready CS2 OEMDownload Adobe InDesign CS2 v4.0 OEM Download Adobe Audition 1.5 OEM Download Adobe Creative Suite 3 Design Premium OEMDownload Microsoft Windows Millennium Edition OEM Download Adobe Contribute CS3 OEM Download Adobe Contribute CS3 OEMDownload Adobe Illustrator CS OEM Download Adobe Creative Suite 2 Premium OEM Download Adobe InCopy CS OEMDownload Adobe Premiere PRO 2.0 OEM Download Adobe Creative Suite 3 Web Premium OEM Download Adobe Creative Suite 3 Design Premium OEMDownload Adobe Acrobat 7.0 Pro OEM Download Adobe Creative Suite 3 Design Premium OEM Download Adobe Pagemaker 7 OEMDownload Adobe Illustrator CS3 OEM Download Adobe Creative Suite Standard Full OEM Download Adobe Premiere Pro 7 OEMDownload Adobe Photoshop Lightroom 1.3 Multilingual OEM Download Adobe Dimensions 3.0 OEM Download Adobe Dreamweaver CS3 OEMDownload Adobe Creative Suite 3 Design Premium OEM Download Adobe Dreamweaver CS3 OEM Download Adobe Photoshop CS + Adobe ImageReady CS OEMDownload Adobe Photoshop Lightroom 1.3 OEM Download Adobe Encore DVD 1.5 OEM Download Microsoft Windows XP Professional x64 OEMDownload Adobe Contribute CS3 OEM Download Adobe Fireworks CS3 OEM Download Adobe InCopy CS OEMDownload Adobe Photoshop CS + Adobe ImageReady CS OEM Download Adobe Flash CS3 Professional OEM Download Adobe Creative Suite Standard Full OEMDownload Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEM Download Adobe Flex 2 OEM Download Adobe Creative Suite 3 Web Premium OEMDownload Adobe GoLive CS2 V 8.0 OEM Download Adobe Flex Builder Professional 3.0 OEM Download Microsoft Windows Server 2008 OEMDownload Adobe Premiere Elements 1.0 OEM Download Adobe FrameMaker 7.0 OEM Download Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEMCheap OEM Software. Buy and download oem Adobe, oem Autodesk, oem Macromedia, oem Microsoft at SoftwareVending.com Download Adobe GoLive CS V 7.0 PC OEM Download Adobe Creative Suite Standard Full OEMDownload Adobe InCopy CS OEM Download Adobe GoLive CS2 V 8.0 OEM Download Microsoft Windows XP Professional x64 OEMDownload Adobe Premiere PRO 2.0 OEM Download Adobe Illustrator 10 OEM Download Adobe Acrobat 8 OEMDownload Adobe GoLive CS V 7.0 PC OEM Download Adobe Illustrator CS OEM Download Adobe Creative Suite Standard Full OEMDownload Microsoft Windows Server 2008 OEM Download Adobe Illustrator CS2 OEM Download Adobe Photoshop Elements 5 OEMDownload Adobe Illustrator CS3 OEM Download Adobe Illustrator CS3 OEM Download Adobe Dreamweaver CS3 OEMDownload Adobe Premiere PRO 2.0 OEM Download Adobe InCopy CS OEM Download Adobe Creative Suite Standard Full OEMDownload Adobe Creative Suite 2 Premium OEM Download Adobe InDesign CS OEM Download Adobe Creative Suite 3 Web Premium OEMDownload Adobe Photoshop 7 OEM Download Adobe InDesign CS2 OEM Download Adobe Contribute CS3 OEMDownload Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEM Download Adobe InDesign CS2 v4.0 OEM Download Adobe Acrobat 7.0 Pro OEMDownload Adobe Creative Suite Standard Full OEM Download Adobe Pagemaker 7 OEM Download Adobe Illustrator CS2 OEMDownload Adobe Pagemaker 7 OEM Download Adobe Photoshop 7 OEM Download Adobe Type Manager Deluxe 4.1 OEMDownload Adobe Premiere Pro 7 OEM Download Adobe Photoshop CS + Adobe ImageReady CS OEM Download Adobe GoLive CS2 V 8.0 OEMDownload Adobe FrameMaker 7.0 OEM Download Adobe Photoshop CS2 + Image ready CS2 OEM Download Adobe Photoshop CS3 Extended OEMDownload Adobe Premiere Pro 1.5 OEM Download Adobe Photoshop CS3 Extended OEM Online Casinogulfstream casino hollywood gun lake casino updated information hammond indiana casino hampton beach casino hampton nhDownload Adobe Dimensions 3.0 OEM Download Adobe Photoshop CS3 French OEM Download Adobe InDesign CS2 v4.0 OEMDownload Adobe Photoshop Lightroom 1.3 OEM Download Adobe Photoshop Elements 4.0 OEM Download Adobe Acrobat 7.0 Pro OEMOnline Casinogulfstream casino hollywood gun lake casino updated information hammond indiana casino hampton beach casino hampton nh Download Adobe Photoshop Elements 5 OEM Download Adobe Acrobat 3D OEMDownload Adobe InDesign CS OEM Download Adobe Photoshop Lightroom 1.3 OEM Download Adobe Type Manager Deluxe 4.1 OEMDownload Adobe Streamline 4.0 OEM Download Adobe Photoshop Lightroom 1.3 Multilingual OEM Download Adobe Premiere Pro 7 OEMDownload Adobe Dimensions 3.0 OEM Download Adobe Premiere Elements 1.0 OEM Download Adobe Photoshop CS3 Extended OEMDownload Adobe Photoshop CS + Adobe ImageReady CS OEM Download Adobe Premiere Elements 3.0 OEM Download Microsoft Windows Millennium Edition OEMDownload Adobe Acrobat 6 professional OEM Download Adobe Premiere Pro 1.5 OEM Download Microsoft Windows XP Professional x64 OEMDownload Adobe Photoshop 7 OEM Download Adobe Premiere PRO 2.0 OEM Download Adobe Photoshop CS3 French OEMDownload Adobe Streamline 4.0 OEM Download Adobe Premiere Pro 7 OEM Download Microsoft Windows NT 4.0 Terminal Server OEMDownload Adobe FrameMaker 7.0 OEM Download Adobe RoboHelp 6 OEM Download Adobe Pagemaker 7 OEMDownload Adobe Premiere Elements 1.0 OEM Download Adobe Streamline 4.0 OEM Download Adobe Contribute CS3 OEMDownload Adobe Acrobat 7.0 Pro OEM Download Adobe Type Manager Deluxe 4.1 OEM Download Adobe Acrobat 6 professional OEMDownload Adobe InDesign CS2 OEM Download Microsoft Digital Image Suite 2006 11.0 OEM Online Casinogulfstream casino hollywood gun lake casino updated information hammond indiana casino hampton beach casino hampton nhDownload Adobe RoboHelp 6 OEM Download Microsoft Exchange Server Enterprise 2003 OEM Download Adobe Creative Suite 2 Premium OEMDownload Adobe Creative Suite 2 Premium OEM Download Microsoft Frontpage 2003 OEM Download Adobe GoLive CS V 7.0 PC OEMDownload Adobe InDesign CS2 OEM Download Microsoft Money 2007 Deluxe OEM Download Adobe Photoshop CS3 Extended OEMDownload Adobe Premiere Pro 1.5 OEM Download Microsoft Office 2000 Premium Edition OEM Download Adobe Acrobat 3D OEMDownload Microsoft Windows NT 4.0 Terminal Server OEM Download Microsoft Office 2003 Professional Edition OEM Download Adobe InDesign CS2 OEMDownload Adobe Creative Suite 3 Web Premium OEM Download Microsoft Office 97 SR2 OEM Download Microsoft Windows Server 2003 Enterprise Edition OEMDownload Adobe InDesign CS2 OEM Download Microsoft Office SharePoint Designer 2007 OEM Download Adobe Illustrator CS3 OEMDownload Adobe Premiere PRO 2.0 OEM Download Microsoft Office Visio Professional 2007 OEM Download Adobe Premiere Elements 1.0 OEMCheap OEM Software. Buy and download oem Adobe, oem Autodesk, oem Macromedia, oem Microsoft at SoftwareVending.com Download Microsoft Office XP Professional OEM Download Adobe Illustrator 10 OEMDownload Adobe GoLive CS V 7.0 PC OEM Download Microsoft OneNote 2003 Pro OEM Download Adobe RoboHelp 6 OEMDownload Adobe Photoshop CS3 Extended OEM Download Microsoft PhotoDraw 2.0 OEM Download Adobe FrameMaker 7.0 OEMDownload Adobe Streamline 4.0 OEM Download Microsoft Picture It Photo Premium 9 OEM Download Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEMDownload Adobe Acrobat 8 OEM Download Microsoft Plus! XP OEM Download Adobe Illustrator CS2 OEMDownload Adobe Photoshop 7 OEM Download Microsoft SQL Server 2000 Enterprise Edition OEM Download Adobe Creative Suite 2 Premium OEMDownload Adobe RoboHelp 6 OEM Download Microsoft Streets & Trips 2006 OEM Download Adobe Photoshop Elements 4.0 OEMDownload Adobe Acrobat 7.0 Pro OEM Download Microsoft Streets and Trips 2004 OEM Download Adobe Acrobat 7.0 Pro OEMDownload Adobe Illustrator CS2 OEM Download Microsoft Visio 2003 Pro OEM Download Adobe Photoshop CS2 + Image ready CS2 OEMDownload Adobe Photoshop 7 OEM Download Microsoft Visual Basic 6.0 Pro OEM Download Adobe Dreamweaver CS3 OEMDownload Adobe RoboHelp 6 OEM Download Microsoft Visual Studio Professional Edition 2005 MSDN OEM Download Adobe Premiere Elements 3.0 OEMDownload Adobe Acrobat 6 professional OEM Download Microsoft Windows 2000 Advanced Server with SP4 OEM Download Adobe Illustrator CS OEMDownload Adobe Illustrator 10 OEM Download Microsoft Windows 2000 Professional with SP4 OEM Download Adobe Streamline 4.0 OEMDownload Adobe Photoshop CS3 French OEM Download Microsoft Windows 98 Second Edition OEM Download Adobe InDesign CS2 OEMDownload Adobe Type Manager Deluxe 4.1 OEM Download Microsoft Windows Millennium Edition OEM Download Adobe Acrobat 8 OEMDownload Adobe GoLive CS V 7.0 PC OEM Download Microsoft Windows NT 4.0 Terminal Server OEM Download Adobe Premiere Elements 3.0 OEMDownload Adobe Photoshop CS2 + Image ready CS2 OEM Download Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEM Download Adobe Creative Suite 3 Design Premium OEMDownload Adobe Streamline 4.0 OEM Download Microsoft Windows Server 2003 Enterprise Edition OEM Download Adobe Streamline 4.0 OEMDownload Adobe Acrobat 8 OEM Download Microsoft Windows Server 2008 OEM Download Adobe GoLive CS V 7.0 PC OEMDownload Adobe Illustrator CS OEM Download Microsoft Windows XP Professional SP2 OEM Download Microsoft Windows Server 2003 Enterprise Edition OEMDownload Adobe Photoshop Elements 5 OEM Download Microsoft Windows XP Professional x64 OEM Download Adobe Illustrator CS3 OEMDownload Microsoft Windows NT 4.0 Terminal Server OEM Download Microsoft Works 7 OEM Online Casinogulfstream casino hollywood gun lake casino updated information hammond indiana casino hampton beach casino hampton nh