Home All Groups Group Topic Archive Search About

Adding the same file to multiple projects.

Author
31 Mar 2005 1:35 PM
UJ
I have a couple of files (type definitions, constants, ...) that I want to
use in multiple projects. How do I make it so that I have only one copy of
the file for multiple projects? If I do add existing to a project, it copies
the file to the project directory. I'd like to have a single directory
(called something like library) that has all the common source code in it
that then gets referenced from the projects.

TIA.

Jeffrey.

Author
31 Mar 2005 2:06 PM
Herfried K. Wagner [MVP]
"UJ" <U*@nowhere.com> schrieb:
>I have a couple of files (type definitions, constants, ...) that I want to
>use in multiple projects. How do I make it so that I have only one copy of
>the file for multiple projects? If I do add existing to a project, it
>copies the file to the project directory. I'd like to have a single
>directory (called something like library) that has all the common source
>code in it that then gets referenced from the projects.

VS.NET provides a way to reference the file instead of creating a copy of
it:  "Project" -> "Add Existing Item..." -> Change the button labeled "Open"
to "Reference File" and press it.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
1 Apr 2005 1:03 AM
Dennis
How do you then distribute the application if the .dll of the common file
isn't in the bin directory of the application?

Show quoteHide quote
"Herfried K. Wagner [MVP]" wrote:

> "UJ" <U*@nowhere.com> schrieb:
> >I have a couple of files (type definitions, constants, ...) that I want to
> >use in multiple projects. How do I make it so that I have only one copy of
> >the file for multiple projects? If I do add existing to a project, it
> >copies the file to the project directory. I'd like to have a single
> >directory (called something like library) that has all the common source
> >code in it that then gets referenced from the projects.
>
> VS.NET provides a way to reference the file instead of creating a copy of
> it:  "Project" -> "Add Existing Item..." -> Change the button labeled "Open"
> to "Reference File" and press it.
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>
>
Author
1 Apr 2005 2:02 AM
Herfried K. Wagner [MVP]
"Dennis" <Den***@discussions.microsoft.com> schrieb:
> How do you then distribute the application if the .dll of the common file
> isn't in the bin directory of the application?

No need to distribute a separate DLL -- the file will be part of the project
and thus compiled into the final EXE/DLL file.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
2 Apr 2005 12:19 AM
Dennis
That will work if you are adding a project or vb module to your main project
but if you adding a reference to a (compiled project, i.e., a .dll file) then
isn't this .dll automatically added to your project bin directory and you
have to distribute it with your application?

Show quoteHide quote
"Herfried K. Wagner [MVP]" wrote:

> "Dennis" <Den***@discussions.microsoft.com> schrieb:
> > How do you then distribute the application if the .dll of the common file
> > isn't in the bin directory of the application?
>
> No need to distribute a separate DLL -- the file will be part of the project
> and thus compiled into the final EXE/DLL file.
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>
>
Author
2 Apr 2005 12:39 AM
Herfried K. Wagner [MVP]
"Dennis" <Den***@discussions.microsoft.com> schrieb:
> That will work if you are adding a project or vb module to your main
> project
> but if you adding a reference to a (compiled project, i.e., a .dll file)
> then
> isn't this .dll automatically added to your project bin directory and you
> have to distribute it with your application?

Yes, in this case you will have to distribute the DLL too.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
1 Apr 2005 7:25 AM
Jon Masterson
> VS.NET provides a way to reference the file instead of creating a copy of
> it:  "Project" -> "Add Existing Item..." -> Change the button labeled "Open"
> to "Reference File" and press it.


Herfried
Does that apply to the standard edition - when I try I get the options,
open, open with and link file but not reference file.  This is on VB 2003

thanks

Jon