By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,708 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,708 IT Pros & Developers. It's quick & easy.

Share source files among projects?

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
* "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

P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
* "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 discussion thread is closed

Replies have been disabled for this discussion.