Seems that C# Doesn’t Have Static Libraries

The things you run into as you’re getting serious with sandbox coding in a new language… I was setting up some pieces for the toy program I’m building (semi-smart de-dup tool with MySQL back end for archive management). After reinstalling Visual Studio 2015 to clear up an issue with creating native DLLs I’ve started framing out the pieces.

I was intending to build this as a console executable with a managed DLL for the bulk of the operational code and a native DLL for things that need interop (currently mostly VSN access for optical media and external drives). As I was laying out the projects I noticed that there was no option for static library creation in the (long) list of project types.

This surprised me a bit as I’ve found it helpful to be able to package code in static libraries while binding the resultant code as a single unit (dll or exe) for distribution. From what I’ve been able to determine with a little google searching it looks as if the managed world only supports dynamic library binding. Makes a bit of sense as the metadata issues could become complex with the same code bound into multiple assemblies.

It is funny that the common suggested solution for cases where code needed to be bound into multiple dlls or exes was to revert back to the really bad old days and just copy the source (or link to source in other projects which seems problematic in a real environment). Seems as if the managed environment assumes that non-trivial projects will consist of a relatively large number of dlls that all get copied from place to place during installs. I’ll probably poke around to see if there’s a .NET equivalent to jar/war packaging…I’d think there ought to be to simplify deployment.

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.