I found a this thread about testing libraries: https://forum.dlang.org/post/mailman.1807.1522279261.3374.digitalmars-d-learn@puremagic.com
But it's very old, yet I have the same issue today.
I want to build a unittest executable for the library I've made, but given I'm trying to use the vscode debugger while using the build command in a preLaunchTask I can't just use dub test. This works fine for non-libraries.
After changing my targetType from 'dynamicLibrary' to automatic I no longer get the error, but now it's just compiling the .lib file.
I also tried adding an empty main but that just makes using it as it's supposed to more obfuscated.