473,322 Members | 1,736 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,322 software developers and data experts.

Share code

Hi,
can i do in c# something identical to an *.h file used in c++ so i can
share class code betwine many application i try to add cs file to my project
but it copy the file to the solotion directory so if i change it it impact
only the current poject but i whant to put a file in spcific directory and
use it from many c# projects.

thanks
Nov 17 '05 #1
2 1444
"Dave" <be******@netvision.net.il> wrote:
i whant to put a file in spcific directory and use it
from many c# projects.


When you add the file to your project in Visual Studio, click the
down-arrow on the "Open" button and choose "Link" instead.

P.
Nov 17 '05 #2
Just like a *.h file in C/C++, each project needs to reference a copy of the
file, the difference being that in C/C++ it was a little easier to say “Use
this .h file in this random, far off folder.”

To do what you are looking for, you’ve got two main options, the first is an
external class library (which is preferred IMO), otherwise you can ‘link’ the
file when you add it to the project.

To link it, go through the regular Add Existing Item process, but before
hitting the open button to finally do so, click the little triangle that is
part of it and choose link. This will setup a link in the project to the file
in the other directory.

Alternatively (if your class is much larger and going to be used by multiple
applications (as well as potentially other developers)), I would suggest
looking into using a class library where that you would build your custom
class into, and then all programs that need access can easily reference it
and use it as needed.

Brendan
"Dave" wrote:
Hi,
can i do in c# something identical to an *.h file used in c++ so i can
share class code betwine many application i try to add cs file to my project
but it copy the file to the solotion directory so if i change it it impact
only the current poject but i whant to put a file in spcific directory and
use it from many c# projects.

thanks

Nov 17 '05 #3

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

Similar topics

7
by: isamusetu | last post by:
anybody knows how to share the dll between the process? I know there is a way to set the #pragma data_seg in the visual studio 6.0 C++, that can make the dll can be shared between the multiple...
2
by: yxq | last post by:
Hello I want to create and delete the folder share, i found that it is ok for generic folder, but it does not work for Root directory(i.e c:\, d:\) The code...
0
by: Andrew Luke | last post by:
Hi There, I'm trying to get a listing of shares from a server. The server is a linux box running samba and LDAP for directory services (just for background info!) I have some code which I...
2
by: Johnny Fugazzi | last post by:
I would like to access a network share from my vb.net application. I do not want to map a drive to the share, however. I would also like to specifiy a user credential to use when connecting to...
4
by: Anders K. Olsen | last post by:
Hello group. I would like to develop my software from a network share, that is, place my code on a network share. Is it possible to grant Full Trust to this share (e.g. X:) and only to this...
3
by: musosdev | last post by:
Hi guys Okay, I've setup my projects to open and compile fine in VS2005 using FPSE and remote web, but it's *really* slow. So I thought I'd have a go at doing it the normal way, by loading from...
3
by: Michel Smit | last post by:
Hello, I have a question. We have a webserver in a domain, DomainA, and a webserver in a DMZ with local users and groups only. I'm trying to copy a file from the DomainA webserver to the DMZ...
6
by: tendim | last post by:
G'day group. Currently our organization us using VB6 based applications, and I am trying to push forward and migrate some of the smaller things to VB.NET, eventually migrating all applications...
0
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, We have a legacy asp application that uses a third party component to upload a file and saves it to a secure network share. The code sets the credentials for the secure network share on the...
6
by: Immortal Nephi | last post by:
First class is the base class. It has two data: m_Base1 and m_Base2. Second class and third class are derived classes and they are derived from first class. m_Base1 and m_Base2 are inherited into...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.