• Advertisement
Sign in to follow this  

C# Using my own DLLs

This topic is 3006 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've written several useful utility classes that I wan't to reuse in my other applications. What's the best way to go about doing this? Right now I have each of those classes in their respective projects and have them compiled to class libraries (DLLs). The trouble I have with this approach is that in each application I have to package the DDL's with the application for it to work right. The other approach I thought of is to simply import the source files into the application's project. But that doesn't feel like the right way of doing it, exposing the utility classes source to the application that's using it. If I were working in C++ I would create static libs and then compile them right into my applications exe. Is there a similar approach I can use in C# were I don't have to repackage DLLs with my application and I don't have to expose the utility class's source to the client application?

Share this post


Link to post
Share on other sites
Advertisement
It's not really viable to static link with C# (tools like ilmerge can be used, but this becomes... complicated). You'll have to ship the DLLs. Installation and packaging tools (such as ClickOnce) can handle deployment of your main assembly plus all dependencies (other DLLs) for you.

However, do note that it's a very bad idea to be creating one DLL per utility class, as you seem to be doing. That creates way more physical overhead than you need and is gaining you nothing but complexity. Rather, you should package all your utility code into one assembly -- or, if it's really warranted, multiple assemblies. But not one per class.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement