Reputation: 379
I have two Visual Studio 2010 projects named OldProject
and NewProject
, both full of .cs
files.
I want to use OldProject
's OldFile.cs
file in NewProject
's NewFile.cs
file.
At the top of NewFile.cs
, I wrote using OldFileNamespace;
to no avail. I tried setting reference paths to no avail. I tried copying OldFile.cs
into NewProject
to no avail, since there are many using
directives in OldFile.cs
which NewProject
does not recognize.
What else can I do?
Upvotes: 0
Views: 61
Reputation: 13313
You simply need to refer the project to your new project.
If for some reason it doesn't work (it should work), create a new class library, add the .cs class in it and refer to it. It does not change anything. But if the classes are only used to be refered to another project, this is a good practice.
myClassLibrary.dll
Don't forget to include it with the using
keyword once you added the reference.
.dll
is.using
statementUpvotes: 3
Reputation: 33873
You most likely need to include the reference to OldProject
as a PROJECT level reference.
Right click your project and click "Add Reference".
Use browse and browse to the file location of OldProject.dll. Add it.
You should now be able to include and access the namespace for OldProject.
Upvotes: 1