Home All Groups Group Topic Archive Search About

VS 2005: how to use the same class.cs in two projects

Author
9 Mar 2006 11:46 PM
Serdge Kooleman
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?

Author
10 Mar 2006 12:14 AM
Tim Wilson
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.

--
Tim Wilson
..NET Compact Framework MVP

Show quoteHide quote
"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?
>
>
>
>
Are all your drivers up to date? click for free checkup

Author
10 Mar 2006 12:23 AM
Chris Mullins
"Serdge Kooleman" <Su***@web.de> wrote in message
> 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?


Add a 4th project "BusinessStuff" to the solution. Put "Myclass.cs" into
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

Bookmark and Share