Search code examples
c#enterprise-librarystatic-librariescode-reuse

Process for creating resuable code


I have many C# applications that require a newly coded security protocol I wrote. There are many classes associated with the protocol, and it is not necessary to view the code at this point by the protocol caller, assuming proper documentation.

I think the process is to create a class library after reviewing Microsoft's Designing for Extensibility but I have never done this before. Can some one outline the proper process for this from creation of the library to implementation of the library? If the answer is not creating a class library, can some one provide a reference detailing process, including requirements?


Solution

    1. Create a new project.
    2. Use "class library" as the type of the project in visual studio. (You can change a project to this type after creation in the project properties as well).
    3. Put your classes in that project.
    4. Other projects then need to reference it. If they are in the same solution just "add reference" and choose the other projects from the "projects" tab. If not in the same solution:
      1. Build the class library.
      2. Go to bin -> debug folder for that project
      3. Place the .dll file in some common location (possibly the GAC).
      4. Add a reference to that .dll file from all projects that need to use it.