473,398 Members | 2,120 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,398 software developers and data experts.

Share source files among projects?

Is it possible to share a single source file among two or more Projects in a
Solution?

I'm not talking about a DLL, just a .vb file that might contain a class or
module with common code to be compiled into each project. That way this
code can be updated once instead of makiing duplicate changes to identical
code within each project.

I have tried putting the source in a common folder, then using Add Existing
Item to add it to each project, but that creates a separate copy of the file
in each project folder. Then I'm back to keeping changes syncronized
manually.

I have been searching VB.NET help and newsgroups, but either this can't be
done or I am asking the wrong questions.

thanks

Dick
Nov 20 '05 #1
5 2028
* "Richard K" <ju******@seventree.com> scripsit:
Is it possible to share a single source file among two or more Projects in a
Solution?


Add the file to the 2nd project by opening the "Add Existing File..."
dialog and choosing "Reference" from the dropdown of the "Add" button.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
"Richard K" <ju******@seventree.com> schrieb

It is sufficient to post the question once. :-)
Is it possible to share a single source file among two or more
Projects in a Solution?

When the "add file" dialog is open, select the file to be linked to the
project, then click on the arrow on the right side next to the "open"
button. In the opening menu, select "link" (or whatever it is called in the
English version).
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Sorry, I don't seem to be following...

When I right click on the project in Solution Explorer, then hover on the
Add line, then pick Add Existing Item from the submenu - I get an Add
Existing Item dialog. But any file selected from outside the project folder
gets phyically copied to the project folder.

In the project right-click menu there is also Add Reference, but that dialog
only allows DLL's to be selected.

Am I doing something wrong here?

Dick

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bq*************@ID-208219.news.uni-berlin.de...
* "Richard K" <ju******@seventree.com> scripsit:
Is it possible to share a single source file among two or more Projects in a Solution?


Add the file to the 2nd project by opening the "Add Existing File..."
dialog and choosing "Reference" from the dropdown of the "Add" button.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #4
I didn't intend for it to be posted 5 times - but Outlook Express kept
telling me the send process had failed so I kept retrying...

But your advice was good, I think I finally understand this.

thanks

Dick

"Armin Zingler" <az*******@freenet.de> wrote in message
news:uO**************@TK2MSFTNGP10.phx.gbl...
"Richard K" <ju******@seventree.com> schrieb

It is sufficient to post the question once. :-)
Is it possible to share a single source file among two or more
Projects in a Solution?

When the "add file" dialog is open, select the file to be linked to the
project, then click on the arrow on the right side next to the "open"
button. In the opening menu, select "link" (or whatever it is called in

the English version).
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
* "Richard K" <ju******@seventree.com> scripsit:
Sorry, I don't seem to be following...

When I right click on the project in Solution Explorer, then hover on the
Add line, then pick Add Existing Item from the submenu - I get an Add
Existing Item dialog. But any file selected from outside the project folder
gets phyically copied to the project folder.


Select the file and choose the "Reference"/"Link File" button from the
dropdown of the dialog's default button.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

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

Similar topics

5
by: Tim Zhao | last post by:
I downloaded the PHP 5 source code from www.php.net web site. It is a tar compressed file. I used WinZip to unzip it. Now I got a whole bunch of files. But I do not know to read these files. Do...
3
by: thxBruin | last post by:
I have a Class CTest in test.cs but two or more projects need this class. So how to share the SOURCE FILE(test.cs, not using dll file) in these projects?
16
by: ad | last post by:
I have write a clss, say DM.cs, and I save it in a independent directory like c:\MyUtil I have a new project in c:\proj1. When I use VS to add the existed c:\MyUtil\DM.cs to the new project,...
1
by: Macca | last post by:
Hi, I have a C# Solution/Application that contain 4 projects. Each of these projects needs at some time to access the same database. I would like to know how to share a single connection...
1
by: Bill Reynen | last post by:
Hello, Working in ASP.NET. I want to create several projects on the web server /Online /Online/App1 /Online/App2 /Online/App3
0
by: Richard K | last post by:
Is it possible to share a single source file among two or more Projects in a Solution? I'm not talking about a DLL, just a .vb file that might contain a class or module with common code to be...
3
by: Ron L | last post by:
I have an application that I am developing that is a front end for a SQL database. We will also be developing a subset of the UI that will work as a (mainly) standalone client that will make a...
9
by: moondaddy | last post by:
I'm using asp.net 2.0 and c# and would like to share some user control between several websites. these websites are on the same server and have a physical location right next to each other like...
2
by: Magnus Bergh | last post by:
I have a solution which contains multiple projects (different applications). Every project use the same typed dataset (and also a few other shared code files). I tried to remove the dataset.xsd...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.