Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,026 | Comments: 44,844

filter by tags archive

This Is Not Open Source(TM)

time to read 10 min | 1937 words

No, it is not a rant against some non OSS tool.

When I was at DevTeach, I talked with a few people that mentioned that their compnay has an... aversion to OSS and they wanted a way around that. Beind technical minded and a "rules, what rules?" types of guy, I suggested that they would take an OSS project (assuming the license allows it), and just rename the namespaces.

This is a possible approach, but it may be too much work in many cases. I suggested post compile weaving, and people looked at me as if I have grown two heads ( I didn't, I checked ). I just now remember this conversation, and wrote this little script with Boo and Mono.Cecil, which would take an existing assembly and rename everything from an old value to a new one.


booi AsmReplace.boo Castle.ActiveRecord.dll Castle Tower

Now enjoy your Tower.ActiveRecord.dll :-)

import Mono.Cecil

import System.IO


if argv.Length != 3:

       print "Usage: booi AsmReplace.boo <dll/exe file> <OldNameSpace> <NewNameSpace>"



if not File.Exists(argv[0]):

       print argv[0] +" does not exists!"



filename = argv[0]

oldNamespace = argv[1]

newNamespace = argv[2]


myLibrary = AssemblyFactory.GetAssembly (filename);

myLibrary.Name.Name = myLibrary.Name.Name.Replace(oldNamespace , newNamespace )


for module as ModuleDefinition in myLibrary.Modules:

       module.Name = module.Name.Replace(oldNamespace , newNamespace )

       for type as TypeDefinition in module.Types:

              type.Namespace = type.Namespace.Replace(oldNamespace , newNamespace )


AssemblyFactory.SaveAssembly(myLibrary, Path.GetFileName(filename.Replace(oldNamespace , newNamespace ) ) )

Oh, and written in notepad on the command line while I waited for #Develop to be installed on a new machine.



Ha! Nice! I've had to deal with a lot of OSS-phobia and this would just be hilarious to do. Fortunately, I haven't needed to go quite this far yet... :P

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Technical observations from my wife (3):
    13 Nov 2015 - Production issues
  2. Production postmortem (13):
    13 Nov 2015 - The case of the “it is slow on that machine (only)”
  3. Speaking (5):
    09 Nov 2015 - Community talk in Kiev, Ukraine–What does it take to be a good developer
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats