2 questions I hope make sense

M

Mike

1.
I am creating a project that will have many c# files
(100+). I want to split this project up into modules but
I am not sure what the best way would be. I was thinking
of creating a blank project and creating other projects
inside this blank project where each one of these
projects would have one namespace. Is there a better way
of organizing a project? Can I have just one project
that contains many other namespaces?

2.
I have a C# file called A.cs which is in a namespace
called AA which is in a project called AAA.
I also have a C# file called B.cs which is in a namespace
called BB which is in a project called BBB.
In B.cs, I want to use the A.cs file. So at the
beginning of the B.cs file, I put:

using AA;

However, I get the following error message:
The type or namespace name 'AA' could not be found (are
you missing a using directive or an assembly reference?)

What can I do to solve this? Any ideas to these questions
will be greatly appreciated. Thanks for your reply.

Mike
 
M

Mark

Hi Mike
I will attempt to answer them for you :)
1. You can split the files into a number of projects and compile each
project into a .NET Module (not assembly!) then you can link the one or more
modules into an Assembly (you have to use the command line compiler to do
all this). That gives you some flexibility in how you use the IDE and
solutions. Try and keep the same namespace in one project ( more for ease
of use than any problems with the framework). As far as i know you can have
more than one namespace per project (even per file - but not per class)

2. Project BBB needs to add a reference to project AAA if they are in the
same solution or Project BBB needs to add a reference to assembly AA if not.
Both ways end up having a copy of assembly AA in the same directory as
assembly BB. Then your using statement will work :)

Hope it helps
Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top