If, like me, you’re using Binsor for configuration, and using the include file mechanism to implement environmental deltas, you’re going to need to refer to the initial file using an absolute path. The reason for this is, if you don’t, a relative path name within the Binsor script uses the current working directory. Just to be annoying, this means that all of your code works until the moment you deploy it, and then your service fails to start (this bears no resemblance to a real issue, I can assure you…)
Anyway, here’s the code you need:
private static void ReadRelativePath(IWindsorContainer container, string relativePath) { string location = System.Reflection.Assembly.GetEntryAssembly().Location; string directory = Path.GetDirectoryName(location); Rhino.Commons.Binsor.BooReader.Read(container, Path.Combine(directory, relativePath)); }
You could potentially fix this by changing the current directory in the program, but that’s the kind of externality I really don’t want to deal with.