This is a good thread, if you are looking to build a shared library callable from other tools rather than a separate process executable: Creating fully self-contained and pre-compiled library
PackageCompiler may still be your best option, depending on what your code needs at runtime.