C
Charlie Calvert
I'm new to C# and am used to Java, where there is a correspondence
between package names and directories. I'm having trouble creating the
same functionality in Visual Studio. In particular, I'm having trouble
compiling such projects.
As an example, suppose I have a project called ConsoleApplication1. It
is stored in a directory called c:\src\ConsoleApplication1. I want to
add a file to this project that is called MyFile.cs and is stored in a
directory called c:\src\ConsoleApplication1\Utils. The source in
MyFile.cs has the following namespace: ConsoleApplication1.Utils.
My problem is accessing a public class declared in MyFile.cs from
ConsoleApplication1.cs. If I try to "Add" MyFile.cs to my project,
Visual Studio has a tendency to copy the file into my current directory.
That is not at all what I want. I want to access the file while it is in
a subdirectory of my main project directory. How do I do this?
I've found something called a References Path in the Properties dialog
for my project, but if it is related to this issue, I don't see how to
use it.
If people feel that all the source code for a C# project should be in
one directory, then please say so. If the solution is to build an
assembly (ie DLL) then please say so, though that is again not at all
what I want to do.
Thank you for your help.
- Charlie
between package names and directories. I'm having trouble creating the
same functionality in Visual Studio. In particular, I'm having trouble
compiling such projects.
As an example, suppose I have a project called ConsoleApplication1. It
is stored in a directory called c:\src\ConsoleApplication1. I want to
add a file to this project that is called MyFile.cs and is stored in a
directory called c:\src\ConsoleApplication1\Utils. The source in
MyFile.cs has the following namespace: ConsoleApplication1.Utils.
My problem is accessing a public class declared in MyFile.cs from
ConsoleApplication1.cs. If I try to "Add" MyFile.cs to my project,
Visual Studio has a tendency to copy the file into my current directory.
That is not at all what I want. I want to access the file while it is in
a subdirectory of my main project directory. How do I do this?
I've found something called a References Path in the Properties dialog
for my project, but if it is related to this issue, I don't see how to
use it.
If people feel that all the source code for a C# project should be in
one directory, then please say so. If the solution is to build an
assembly (ie DLL) then please say so, though that is again not at all
what I want to do.
Thank you for your help.
- Charlie