473,624 Members | 2,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding the same file to multiple projects.

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.
Nov 21 '05 #1
6 1227
"UJ" <UJ@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/>

Nov 21 '05 #2
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" <UJ@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/>

Nov 21 '05 #3
"Dennis" <De****@discuss ions.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/>

Nov 21 '05 #4
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
Nov 21 '05 #5
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" <De****@discuss ions.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/>

Nov 21 '05 #6
"Dennis" <De****@discuss ions.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/>

Nov 21 '05 #7

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

Similar topics

3
2576
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...
7
5406
by: Wysiwyg | last post by:
Is there any way to add an embedded resource to a project without copying it to the project's directory? I have shared resources and don't want each project using the images, xml files, etc. to need to be updated with the current copy before being built. I also don't want projects being built with the old copy. Thanks! Bill
0
1030
by: Martin Balog | last post by:
Hi, i have a solution with two projects opened. both projects have classes with the same name (for example CMainFrame) and the file name is the same, too. imagine i want to add a virtual function or a message handler using the properties widnow (i click on the combobox on the proper line on the properties window). what always happends to me is that the new function is added wrong. the wizard uses .h file from the first project and .cpp...
1
2076
by: Jody Gelowitz | last post by:
Within ASP.NET, is it possible to use a single .vb file and have it shared (or accessed) between multiple projects without having that file being copied to each project folder? ie. C:\Projects\MyProject1 (project 1) C:\Projects\MyProject2 (project 2) C:\Projects\CommonFiles\MyCommonFile.vb (common file directly accessed and compiled from Project1 and Project2)
1
5594
by: Christopher W. Douglas | last post by:
I am building a VB.NET application in Visual Studio.NET 2003. I have an existing project with code and forms I want to reuse in this project. If I am copying a module file, then Add Existing Item works fine. However, if I am copying a form, it pulls it in as a module file, not as a form. I have tried adding the .resx file first, adding the .vb and .resx file at the same time, or deleting the .resx file, nothing seems to work. I have a...
2
2781
by: Brian Henry | last post by:
is there any way to make an assembly file accessable across multiple projects (we have over 20 that need the info all to be the same at build version, title, desc, copyright,etc) i saw MS did this with the quick starts with what looks like to be a short cut to a file in each project... is there any way to have the assembly as the actuall file in one project and all the others reference it? this is also a source controled solution too by the...
4
10480
by: Bill Nguyen | last post by:
I would like to include a module from another project. When I added existing item, VS copied the module to the current project's folder so that whatever I did to this module doesn't reflect in the original module. this is NOT what I expected. Is there a way to share a module (.vb) among multiple projects? Thanks Bill
4
1270
by: David W | last post by:
In VS .NET 2003 (SP1) I wanted to add a preprocessor symbol to all configurations of all projects in a solution. I selected all the projects and then went to Properties, where I went to the preprocessor symbols edit box. Nothing was in there, presumably because no symbols are common to all selections, which is as expected. However, when I added the new symbol I found that _all_ other symbols, such as _WINDOWS etc. had been deleted from all...
12
1499
by: Jeff Gaines | last post by:
I am a hobbyist programmer, using C# and VS2008 and writing desktop apps. I am trying hard to take a modular approach to avoid re-inventing the wheel but I'm finding it a bit frustrating. For instance I have a ListViewEx class (based on a ListView) which has in-place editing and a sorter based on column content. It uses custom column headers and custom ListViewItems. In turn the ListViewEx may have a further class base on it and so on. ...
0
8238
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8624
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8478
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7164
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
6111
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
4082
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
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1485
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.