locked
Using the same code in multiple projects RRS feed

  • Question

  • User-1775661647 posted

    I have some utility code that will be used in two projects, each in its own solution. I have put this utility code into a class and I want each project to refer to the same source file. However, when I Add->Existing item, VS2010 makes a copy of my utility class file and adds it to the current project. How do I share code across projects? Must it be at the compiled (library) level?

    Many thanks.

    Sunday, September 30, 2012 9:55 PM

Answers

  • User1077185331 posted

    Hi,

    You have to write your utility code in one class library, and use that class library reference in your projects.

    Add reference of class library in your project. 

    Right click on your reference folder > Add Reference (of your class library)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, September 30, 2012 10:08 PM