问题
I was wondering if two separate C# Windows projects (in two separate solutions) can share one .cs file with shared definitions? If so, then how?
PS. One project is ASP.NET web app and the second project is C# Windows service (started as a Windows console project.)
回答1:
Add Existing Item->Add As Link (found by selecting drop down on Add button)
回答2:
Move that cs file/code to be shared to a new class library project and refer that in your other 2 projects.
来源:https://stackoverflow.com/questions/15907467/share-cs-file-among-vs-2010-c-sharp-projects