PC Review


Reply
Thread Tools Rate Thread

Adding the same file to multiple projects.

 
 
UJ
Guest
Posts: n/a
 
      31st Mar 2005
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.


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      31st Mar 2005
"UJ" <(E-Mail Removed)> 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/>

 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      1st Apr 2005
How do you then distribute the application if the .dll of the common file
isn't in the bin directory of the application?

"Herfried K. Wagner [MVP]" wrote:

> "UJ" <(E-Mail Removed)> 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/>
>
>

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      1st Apr 2005
"Dennis" <(E-Mail Removed)> 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/>

 
Reply With Quote
 
Jon Masterson
Guest
Posts: n/a
 
      1st Apr 2005

> 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
 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      2nd Apr 2005
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?

"Herfried K. Wagner [MVP]" wrote:

> "Dennis" <(E-Mail Removed)> 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/>
>
>

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      2nd Apr 2005
"Dennis" <(E-Mail Removed)> 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/>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie in .net: working with 1 file in multiple projects Guy Cohen Microsoft VB .NET 6 8th Jan 2008 12:06 PM
newbie in .net: working with 1 file in multiple projects Guy Cohen Microsoft VB .NET 0 7th Jan 2008 07:07 AM
Multiple projects to 1 movie file =?Utf-8?B?cnVmZmxvY2tz?= Windows XP MovieMaker 9 7th Feb 2005 05:33 PM
Sharing a common CS file throughout Multiple Projects? Harry Whitehouse Microsoft C# .NET 3 3rd Aug 2004 01:54 AM
Link a file to multiple projects Crirus Microsoft VB .NET 2 2nd Nov 2003 04:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:19 AM.