C# – Add codebase as reference instead of copy Visual Studio

csilverlightvisual studio

This may be a ridiculous question for you C# pros but here I go. I'm a Flash developer getting started in Silverlight and I'm trying to figure out how to create a "codebase" (a reusable set of classes) for animation. I'd like to store it in a single location and reuse it across a bunch of different projects. Normally in Flash I would add a "project path" reference and then start using the code. My question is, how do I add a folder to visual studio so that I can "use" those classes in my project. I tried "Add > Existing Item" but that copied the files into my project directory.

Best Answer

The easiest way would to create a new ClassLibrary project and build it. This will output a .dll file in a folder you can specify in the project settings menus, which you reference from every project that needs it.

Also, you can copy this .dll into the /bin/ folder of your project - this will do the same thing for this specific project, but when you start the next one you can change some details in the codebase library without breaking the first project.