469,319 Members | 2,420 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,319 developers. It's quick & easy.

Charing Code with multiple projects

So I'm trying to Write a Backend to something and in testing I decided to
create a generic front end app that can simulate the passed in Data.

So I have 2 projects in my solution, though I'm finding that I've created
classes, structs, enums, constants that are going to be neede by both.

I don't want to have one project reference the other as they are not
'related' I want some 3rd project or something that I put all the stuff in.
Then I'm not sure what to put them in once they are in this 3rd Project.
CodeFile, Module, Class file, etc...

Okay, so this is a total noob Q, but I'm just used to the #INCLUDE and just
point to it and it all works. Seems like I cant define some things (i.e.
CONST) out of the Class scope, and I can only do that if its in a Module,
though the module does not seem to be seen by the other projects?

Okay, Maybe I need to go back to Pascal...

Thanks,
Scott<-=
Jun 27 '08 #1
10 1022
Scott,

Simple create a library project, this will result in a DLL that you can
reference from everywhere you want.

Cor

"Scott Townsend" <sc********@community.nospamschreef in bericht
news:ub**************@TK2MSFTNGP05.phx.gbl...
So I'm trying to Write a Backend to something and in testing I decided to
create a generic front end app that can simulate the passed in Data.

So I have 2 projects in my solution, though I'm finding that I've created
classes, structs, enums, constants that are going to be neede by both.

I don't want to have one project reference the other as they are not
'related' I want some 3rd project or something that I put all the stuff
in.
Then I'm not sure what to put them in once they are in this 3rd Project.
CodeFile, Module, Class file, etc...

Okay, so this is a total noob Q, but I'm just used to the #INCLUDE and
just point to it and it all works. Seems like I cant define some things
(i.e. CONST) out of the Class scope, and I can only do that if its in a
Module, though the module does not seem to be seen by the other projects?

Okay, Maybe I need to go back to Pascal...

Thanks,
Scott<-=

Jun 27 '08 #2
"Scott Townsend" <sc********@community.nospamschrieb
So I'm trying to Write a Backend to something and in testing I
decided to create a generic front end app that can simulate the
passed in Data.

So I have 2 projects in my solution, though I'm finding that I've
created classes, structs, enums, constants that are going to be
neede by both.

I don't want to have one project reference the other as they are not
'related' I want some 3rd project or something that I put all the
stuff in. Then I'm not sure what to put them in once they are in
this 3rd Project. CodeFile, Module, Class file, etc...

Okay, so this is a total noob Q, but I'm just used to the #INCLUDE
and just point to it and it all works. Seems like I cant define some
things (i.e. CONST) out of the Class scope, and I can only do that
if its in a Module, though the module does not seem to be seen by
the other projects?

Okay, Maybe I need to go back to Pascal...
It's common practice to put the reusable code into a DLL and reference
it from any project you want.
Armin

Jun 27 '08 #3
Sorry Cor, forgot mine in the outbox yesterday.
Armin
Jun 27 '08 #4
Armin,

As you do it, I know it is no echo.

:-)

Cor

"Armin Zingler" <az*******@freenet.deschreef in bericht
news:eU**************@TK2MSFTNGP02.phx.gbl...
Sorry Cor, forgot mine in the outbox yesterday.
Armin
Jun 27 '08 #5
What about Constants? Seems like they only are available either in a Module
or in a Class, If I want to use them in multiple classes I can put them in a
Module for the Project, but when I put them in a Module for another project,
they cant bee seen?

Thanks,
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Scott,

Simple create a library project, this will result in a DLL that you can
reference from everywhere you want.

Cor

"Scott Townsend" <sc********@community.nospamschreef in bericht
news:ub**************@TK2MSFTNGP05.phx.gbl...
>So I'm trying to Write a Backend to something and in testing I decided to
create a generic front end app that can simulate the passed in Data.

So I have 2 projects in my solution, though I'm finding that I've created
classes, structs, enums, constants that are going to be neede by both.

I don't want to have one project reference the other as they are not
'related' I want some 3rd project or something that I put all the stuff
in.
Then I'm not sure what to put them in once they are in this 3rd Project.
CodeFile, Module, Class file, etc...

Okay, so this is a total noob Q, but I'm just used to the #INCLUDE and
just point to it and it all works. Seems like I cant define some things
(i.e. CONST) out of the Class scope, and I can only do that if its in a
Module, though the module does not seem to be seen by the other projects?

Okay, Maybe I need to go back to Pascal...

Thanks,
Scott<-=


Jun 27 '08 #6

Scott,

Just try to forget constants while you are programming with OOP.

It is mostly a trashbin with all kind of constants which are never used. If
you really need them, then put them in a config.file.

Cor

"Scott Townsend" <sc********@community.nospamschreef in bericht
news:uX**************@TK2MSFTNGP04.phx.gbl...
What about Constants? Seems like they only are available either in a
Module or in a Class, If I want to use them in multiple classes I can put
them in a Module for the Project, but when I put them in a Module for
another project, they cant bee seen?

Thanks,
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>Scott,

Simple create a library project, this will result in a DLL that you can
reference from everywhere you want.

Cor

"Scott Townsend" <sc********@community.nospamschreef in bericht
news:ub**************@TK2MSFTNGP05.phx.gbl...
>>So I'm trying to Write a Backend to something and in testing I decided
to create a generic front end app that can simulate the passed in Data.

So I have 2 projects in my solution, though I'm finding that I've
created classes, structs, enums, constants that are going to be neede by
both.

I don't want to have one project reference the other as they are not
'related' I want some 3rd project or something that I put all the stuff
in.
Then I'm not sure what to put them in once they are in this 3rd Project.
CodeFile, Module, Class file, etc...

Okay, so this is a total noob Q, but I'm just used to the #INCLUDE and
just point to it and it all works. Seems like I cant define some things
(i.e. CONST) out of the Class scope, and I can only do that if its in a
Module, though the module does not seem to be seen by the other
projects?

Okay, Maybe I need to go back to Pascal...

Thanks,
Scott<-=


Jun 27 '08 #7
What? You dont use Constants anymore??
So are you talking about the app.config?

How can I share those with Multiple Projects?

I'm developing a Client Server App that will share some common components
(Constants and Functions). I'd like to just have one file/Project with info
it it that both can share.

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:3D**********************************@microsof t.com...
>
Scott,

Just try to forget constants while you are programming with OOP.

It is mostly a trashbin with all kind of constants which are never used.
If you really need them, then put them in a config.file.

Cor

"Scott Townsend" <sc********@community.nospamschreef in bericht
news:uX**************@TK2MSFTNGP04.phx.gbl...
>What about Constants? Seems like they only are available either in a
Module or in a Class, If I want to use them in multiple classes I can put
them in a Module for the Project, but when I put them in a Module for
another project, they cant bee seen?

Thanks,
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>Scott,

Simple create a library project, this will result in a DLL that you can
reference from everywhere you want.

Cor

"Scott Townsend" <sc********@community.nospamschreef in bericht
news:ub**************@TK2MSFTNGP05.phx.gbl...
So I'm trying to Write a Backend to something and in testing I decided
to create a generic front end app that can simulate the passed in Data.

So I have 2 projects in my solution, though I'm finding that I've
created classes, structs, enums, constants that are going to be neede
by both.

I don't want to have one project reference the other as they are not
'related' I want some 3rd project or something that I put all the stuff
in.
Then I'm not sure what to put them in once they are in this 3rd
Project. CodeFile, Module, Class file, etc...

Okay, so this is a total noob Q, but I'm just used to the #INCLUDE and
just point to it and it all works. Seems like I cant define some things
(i.e. CONST) out of the Class scope, and I can only do that if its in a
Module, though the module does not seem to be seen by the other
projects?

Okay, Maybe I need to go back to Pascal...

Thanks,
Scott<-=


Jun 27 '08 #8
"Scott Townsend" <sc********@community.nospamschrieb
What about Constants? Seems like they only are available either in
a Module or in a Class, If I want to use them in multiple classes I
can put them in a Module for the Project, but when I put them in a
Module for another project, they cant bee seen?

What about an Enum? Can be outside a class.

Modules are rarely used because it's like putting all your files in the
root folder of your hard disc.
Armin

Jun 27 '08 #9
"Scott Townsend" <sc********@community.nospamschrieb:
What about Constants? Seems like they only are available either in a
Module or in a Class, If I want to use them in multiple classes I can put
them in a Module for the Project, but when I put them in a Module for
another project, they cant bee seen?
Make sure the access modifier is set to 'Public'. The default modifier is
'Friend'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jun 27 '08 #10
Scott,

You can forever free to do what you want.

However DLL's with lot of constants only will grow, because you never know
if it is already used and you are creating everytime new versions of the
same DLL's. In other words, you create your own private DLL hell.

But on the other hand, creating config files and place those standard in
your projects will do the same, although then the problem is probably better
to keep in hand.

Cor

"Scott Townsend" <sc********@community.nospamschreef in bericht
news:OQ**************@TK2MSFTNGP05.phx.gbl...
What? You dont use Constants anymore??
So are you talking about the app.config?

How can I share those with Multiple Projects?

I'm developing a Client Server App that will share some common components
(Constants and Functions). I'd like to just have one file/Project with
info it it that both can share.

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:3D**********************************@microsof t.com...
>>
Scott,

Just try to forget constants while you are programming with OOP.

It is mostly a trashbin with all kind of constants which are never used.
If you really need them, then put them in a config.file.

Cor

"Scott Townsend" <sc********@community.nospamschreef in bericht
news:uX**************@TK2MSFTNGP04.phx.gbl...
>>What about Constants? Seems like they only are available either in a
Module or in a Class, If I want to use them in multiple classes I can
put them in a Module for the Project, but when I put them in a Module
for another project, they cant bee seen?

Thanks,
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl.. .
Scott,

Simple create a library project, this will result in a DLL that you can
reference from everywhere you want.

Cor

"Scott Townsend" <sc********@community.nospamschreef in bericht
news:ub**************@TK2MSFTNGP05.phx.gbl...
So I'm trying to Write a Backend to something and in testing I decided
to create a generic front end app that can simulate the passed in
Data.
>
So I have 2 projects in my solution, though I'm finding that I've
created classes, structs, enums, constants that are going to be neede
by both.
>
I don't want to have one project reference the other as they are not
'related' I want some 3rd project or something that I put all the
stuff in.
Then I'm not sure what to put them in once they are in this 3rd
Project. CodeFile, Module, Class file, etc...
>
Okay, so this is a total noob Q, but I'm just used to the #INCLUDE and
just point to it and it all works. Seems like I cant define some
things (i.e. CONST) out of the Class scope, and I can only do that if
its in a Module, though the module does not seem to be seen by the
other projects?
>
Okay, Maybe I need to go back to Pascal...
>
Thanks,
Scott<-=
>


Jun 27 '08 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Harry Whitehouse | last post: by
3 posts views Thread by Galore | last post: by
1 post views Thread by Jody Gelowitz | last post: by
2 posts views Thread by Samuel L Matzen | last post: by
13 posts views Thread by Paul Cheetham | last post: by
2 posts views Thread by Jeff Dege | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.