473,387 Members | 3,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to Link Class files to multiple projects.

I am trying to include two class files into a web service project. The
structure I have is a top level solution and project in a folder and below
that, the web service project in it's own folder. In the top level folder I
have two class files, classA.cs and classB.cs.

In the web service project, I use Add>Existing Item... and browse to select
the files in the parent directory. Unfortunately, when I hit the Open
button in the file select dialog, it makes a COPY of the files into the web
service project folder. I only want one version of a class file around.
Otherwise the maintenance issues are horrendous.

I'm looking for the equivalent to #include... that one would use in a C++
project but I can use that in a C# project.

There was a reference to this problem in this newsgroup on Nov 23, 2001 with
a URL
http://groups-beta.google.com/group/...8c7bcade03cd7a .

One of the messages in the thread gives this advice:

Ian R Nov 23 2001, 4:20 pm show options

Newsgroups: microsoft.public.dotnet.languages.csharp
From: "Ian R" <i...@na.net> - Find messages by this author
Date: Fri, 23 Nov 2001 19:20:08 -0500
Local: Fri, Nov 23 2001 4:20 pm
Subject: Re: how to "#include" a file in C#
Reply to Author | Forward | Print | Individual Message | Show
original | Report Abuse

Add Existing Item. When the select file dialog appears, highlight the
required file then drop the open button down to link file.

When I select the file(s) in the parent directory, the drop arrow on the
"Open" button only gives me a choice of "Open" or "Open with..." The "Open
with..." allows me to choose a program with which to open the file (such as
XML Schema editor, C# Editor, etc.) but there is no mention of a "Link."

Am I missing something or has VS.NET 2003 changed from what was around in
2001?

Is there a way to share files without creating a library?

Ed
--
Edward E.L. Mitchell
Phone: (239)415-7039
6707 Daniel Court
Fort Myers, FL 33908


Nov 16 '05 #1
5 13442
I think what you want to do is create a separate Assembly, with your base
classes in it. That will compile to a .dll which you will includeas a
Reference in your other Apps. In VS.Net you can add references to not only
Microsoft assemblies, but also your own assemblies. When you choose Add
Reference, you get a panel with three tabs on it, one of the tabs is
Projects which allows to to add a ref to your other project outputs, or you
can browse to the .dll. When you build you Web app only the .dll will be
copied.

JIM
"Edward Mitchell" <EE*********@newsgroup.nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I am trying to include two class files into a web service project. The
structure I have is a top level solution and project in a folder and below
that, the web service project in it's own folder. In the top level folder
I have two class files, classA.cs and classB.cs.

In the web service project, I use Add>Existing Item... and browse to
select the files in the parent directory. Unfortunately, when I hit the
Open button in the file select dialog, it makes a COPY of the files into
the web service project folder. I only want one version of a class file
around. Otherwise the maintenance issues are horrendous.

I'm looking for the equivalent to #include... that one would use in a C++
project but I can use that in a C# project.

There was a reference to this problem in this newsgroup on Nov 23, 2001
with a URL
http://groups-beta.google.com/group/...8c7bcade03cd7a .

One of the messages in the thread gives this advice:

Ian R Nov 23 2001, 4:20 pm show options

Newsgroups: microsoft.public.dotnet.languages.csharp
From: "Ian R" <i...@na.net> - Find messages by this author
Date: Fri, 23 Nov 2001 19:20:08 -0500
Local: Fri, Nov 23 2001 4:20 pm
Subject: Re: how to "#include" a file in C#
Reply to Author | Forward | Print | Individual Message | Show
original | Report Abuse

Add Existing Item. When the select file dialog appears, highlight the
required file then drop the open button down to link file.

When I select the file(s) in the parent directory, the drop arrow on the
"Open" button only gives me a choice of "Open" or "Open with..." The
"Open with..." allows me to choose a program with which to open the file
(such as XML Schema editor, C# Editor, etc.) but there is no mention of a
"Link."

Am I missing something or has VS.NET 2003 changed from what was around in
2001?

Is there a way to share files without creating a library?

Ed
--
Edward E.L. Mitchell
Phone: (239)415-7039
6707 Daniel Court
Fort Myers, FL 33908

Nov 16 '05 #2
Jim,

Thanks for the feedback. I see now from the help that I can't link to a
file if the project is a Web App. I also have a simple Windows App and in
this Solution the drop down "Open" for "Add Existing Item..." shows three
possibilities, the third being "Link File." The Web App loses this third
line!

I'll follow your advice and create the assembly.

Ed
"James" <no****@hypercon.net> wrote in message
news:eq**************@TK2MSFTNGP15.phx.gbl...
I think what you want to do is create a separate Assembly, with your base
classes in it. That will compile to a .dll which you will includeas a
Reference in your other Apps. In VS.Net you can add references to not only
Microsoft assemblies, but also your own assemblies. When you choose Add
Reference, you get a panel with three tabs on it, one of the tabs is
Projects which allows to to add a ref to your other project outputs, or you
can browse to the .dll. When you build you Web app only the .dll will be
copied.

JIM
"Edward Mitchell" <EE*********@newsgroup.nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I am trying to include two class files into a web service project. The
structure I have is a top level solution and project in a folder and below
that, the web service project in it's own folder. In the top level folder
I have two class files, classA.cs and classB.cs.

In the web service project, I use Add>Existing Item... and browse to
select the files in the parent directory. Unfortunately, when I hit the
Open button in the file select dialog, it makes a COPY of the files into
the web service project folder. I only want one version of a class file
around. Otherwise the maintenance issues are horrendous.

I'm looking for the equivalent to #include... that one would use in a C++
project but I can use that in a C# project.

There was a reference to this problem in this newsgroup on Nov 23, 2001
with a URL
http://groups-beta.google.com/group/...8c7bcade03cd7a .

One of the messages in the thread gives this advice:

Ian R Nov 23 2001, 4:20 pm show options

Newsgroups: microsoft.public.dotnet.languages.csharp
From: "Ian R" <i...@na.net> - Find messages by this author
Date: Fri, 23 Nov 2001 19:20:08 -0500
Local: Fri, Nov 23 2001 4:20 pm
Subject: Re: how to "#include" a file in C#
Reply to Author | Forward | Print | Individual Message | Show
original | Report Abuse

Add Existing Item. When the select file dialog appears, highlight
the
required file then drop the open button down to link file.

When I select the file(s) in the parent directory, the drop arrow on the
"Open" button only gives me a choice of "Open" or "Open with..." The
"Open with..." allows me to choose a program with which to open the file
(such as XML Schema editor, C# Editor, etc.) but there is no mention of a
"Link."

Am I missing something or has VS.NET 2003 changed from what was around in
2001?

Is there a way to share files without creating a library?

Ed
--
Edward E.L. Mitchell
Phone: (239)415-7039
6707 Daniel Court
Fort Myers, FL 33908


Nov 16 '05 #3
Hi Edward,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to add a link to existing
file. If there is any misunderstanding, please feel free to let me know.

As far as I know, the Web application doesn't support add link to a file.
So I agree with Jim's advice to create the assembly.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #4
Kevin,

You are correct that I thought that I wanted to add a link. Coming from
C++, I expected to have one file for a class, many classes many files and
then share the classes by using the #include statement that isn't used in
C#. I searched this group and found a reference that recommended adding a
link to a file in another directory. Then I found that a Web App can't have
links!

In C++ I'd have to add the .obj files when the project is linked so that is
very similar to adding a library reference in C#. It was just that I was
unfamiliar with the oddities of C#.

Ed
"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:fP**************@TK2MSFTNGXA02.phx.gbl...
Hi Edward,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to add a link to existing
file. If there is any misunderstanding, please feel free to let me know.

As far as I know, the Web application doesn't support add link to a file.
So I agree with Jim's advice to create the assembly.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #5
Hi Edward,

I'm sorry about the inconvenience, but currently, it seems that the only
workaround is to create the assembly.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: RK | last post by:
Hi I am working on C# application, where in I may require just one app.config for the C#.NET solution with multiple windows application projects. I know one web.config can be used for multiple...
0
by: Mark | last post by:
We have multiple projects that we are going to place in the virtual directory on our web server. For example, we might have project1, project2, and project3, and each has there own set of .dll. ...
5
by: cybertof | last post by:
Hi ! What is the common use of sharing a single .cs across multiple project files ? I think it's to share common classes between projects. I have actually a .cs file shared accross multiple...
2
by: Ed_P. | last post by:
Hello, Up to this point, I've been using C# to create simple applications that only use on Project to store Windows Forms and other Files. The project has been complied into an EXE. The exe file...
3
by: Harry Whitehouse | last post by:
I'm developing a small class which will be used in a number of distinct C# projects. This small class is undergoing constant change/refinement as I try to employ it in the different projects. ...
5
by: Raed Sawalha | last post by:
We have a web application with at least 570 Pages and 10's of user controls ....all under project name LinkDevProject ...recently we start separating the project into multiple projects ....the...
2
by: mamatha k via .NET 247 | last post by:
(Type your message here) i have 5 projects in a single solution file of the VB.NET.Onlyone project is the startup project and another projects containsthe class files.I want the startup project uses...
2
by: Jonathan Kacprowicz | last post by:
I am trying to create a build process using MSBuild that will build my multiple projects all with the same AssemblyVersion and AssemblyFileVersion. I have tried using the AssemblyInfo task from...
10
by: Scott Townsend | last post by:
So I'm trying to Write a Backend to something and in testing I decided to create a generic front end app that can simulate the passed in Data. So I have 2 projects in my solution, though I'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.