|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VS 2005: how to use the same class.cs in two projectsc# how to use the same class in two projects?
i have solution that consists of website, winapp and web service. i need to use the same class MyClass.cs in all three applications. i cannot figure out how to do in the VS 2005? You'd have at least two choices. You can (a) compile the contents of the
MyClass.cs file into a Class Library project and then consume the assembly from the other projects, or (b) when you add the file to a project you should be able to select the "link file" option from the dropdown on the "open" button - this would allow you to share (link) the file between other projects. -- Show quoteHide quoteTim Wilson ..NET Compact Framework MVP "Serdge Kooleman" <Su***@web.de> wrote in message news:OogM4P9QGHA.2300@TK2MSFTNGP11.phx.gbl... > c# how to use the same class in two projects? > > > > i have solution that consists of website, winapp and web service. > > i need to use the same class MyClass.cs in all three applications. > > i cannot figure out how to do in the VS 2005? > > > > "Serdge Kooleman" <Su***@web.de> wrote in message Add a 4th project "BusinessStuff" to the solution. Put "Myclass.cs" into > i have solution that consists of website, winapp and web service. > > i need to use the same class MyClass.cs in all three applications. > > i cannot figure out how to do in the VS 2005? that project. Add a proiject reference from website, winapp, and webservice to the BusinessStuff project. Now, in any of those, just say, "BusinessStuff.MyClass mc;" and you're good to go. -- Chris Mullins |
|||||||||||||||||||||||