473,594 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.publi c.dotnet.langua ges.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 13463
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*********@ne wsgroup.nospam> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.publi c.dotnet.langua ges.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****@hyperco n.net> wrote in message
news:eq******** ******@TK2MSFTN GP15.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*********@ne wsgroup.nospam> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.publi c.dotnet.langua ges.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 misunderstandin g, 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.mic rosoft.com> wrote in message
news:fP******** ******@TK2MSFTN GXA02.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 misunderstandin g, 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
5387
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 projects, can I use app.config is the same way?? thanx in advance. RK
0
1089
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. This is intentional so that the code for each project is independent and encapsulated from the other projects. Now, all three projects are going to have a similar look and feel - images, users controls, cascading style sheets, etc. If I break...
5
5356
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 projects in a same solution. It's nice to have a common "set" of Classes. Is this the only way to share classes between projects ?
2
1719
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 that is generated has balooned to about 500kb, which is something I don't want to happen! Although this has approach has been ok for the small applications I've built so far I'd like to move to using the "One Solution with Multiple Projects"...
3
2572
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. I'm trying to maintain a *single* copy of the CS file that can be used in the multiple .NET projects. But I'm observing that when you add a CS file to a given .NET project, subsequent modifications to that file are only saved in the current...
5
5084
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 problem we have in user controls how to share them without duplicate the control in each project ....we need to remain the controls in main project and all subproject use them .....what is the avaiable technique to achieve this?
2
4529
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 the class ofremaining project at the runtime.How can i make a relationbetween those projects.If any knows please tell me the idea,inever worked with multiple projects. -------------------------------- From: mamatha k -----------------------...
2
8148
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 the community tasks projects (http://msbuildtasks.tigris.org/) and the AssemblyInfoTask from the MSBuild blog (http://www.gotdotnet.com/codegallery/codegallery.aspx?id=93d23e13-c653-4815-9e79-16107919f93e). My scenario is this: I have several...
10
1183
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 finding that I've created classes, structs, enums, constants that are going to be neede by both. I don't want to have one project reference the other as they are not 'related' I want some 3rd project or something that I put all the stuff in. Then...
0
7876
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
6654
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5408
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3859
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3897
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2385
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1478
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1210
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.