473,508 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)

What is the procedure for using a class defined in the same solution
but in another project?
The language I am using is c-sharp.

I have a solution with two projects in it. A c-sharp program in
project1 uses MyClass, which is defined in project2. In the solution
properties I set project1 to depend on project2.

I keep getting the "type or namespace name 'MyClass' could not be
found" error.

I defined a namespace in project2 and made sure MyClass was encompassed
by this namespace. Then I put the "using namespace" statement in the
project1 program.
This did not help.

Any suggestions?

Dec 25 '05 #1
4 4803

carqs123 wrote:
What is the procedure for using a class defined in the same solution
but in another project?
The language I am using is c-sharp.

I have a solution with two projects in it. A c-sharp program in
project1 uses MyClass, which is defined in project2. In the solution
properties I set project1 to depend on project2.

I keep getting the "type or namespace name 'MyClass' could not be
found" error.

I defined a namespace in project2 and made sure MyClass was encompassed
by this namespace. Then I put the "using namespace" statement in the
project1 program.
This did not help.

Any suggestions?


I'm not entirely sure what you are trying to say here, but I think your
answer is to add a reference to the other project. Fully qualifying
your
calls to the secondary namespace class (i.e. Namespace2.MyClass2)
wouldn't hurt either :)

Matt

Dec 25 '05 #2
Matt wrote:
I'm not entirely sure what you are trying to say here, but I think your
answer is to add a reference to the other project. Fully qualifying
your
calls to the secondary namespace class (i.e. Namespace2.MyClass2)
wouldn't hurt either :)


Right. How does one do that?

I tried using Namespace2.MyClass2 in using statement and variable
definitions.
I get... "type or namespace Namespace2 could not be found..."

How does one "add a reference" ?

Dec 26 '05 #3

carqs123 wrote:
Matt wrote:
I'm not entirely sure what you are trying to say here, but I think your
answer is to add a reference to the other project. Fully qualifying
your
calls to the secondary namespace class (i.e. Namespace2.MyClass2)
wouldn't hurt either :)


Right. How does one do that?

I tried using Namespace2.MyClass2 in using statement and variable
definitions.
I get... "type or namespace Namespace2 could not be found..."

How does one "add a reference" ?


In the solution explorer view, you will see a list of references. Right
click on it
and you'll see "add". Just use that. The references are near the top,
right below
the solution name.
Matt

Dec 26 '05 #4
OK OK, figured it out. Right mouse click on the references folder in
the solutions explorer. Add Reference. Thank you.

Dec 26 '05 #5

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

Similar topics

0
6278
by: Nick Malik | last post by:
Instead of posting a problem, I will post a solution to a problem that I've seen posted many times. One which I just hit and solved. I've been using signed assemblies (have to... they are...
2
9210
by: Matthew Louden | last post by:
using System.Data; using System.Data.SqlClient; //etc... SqlConnection conn = new SqlConnection(connString); SQLDataSetCommand myCmd = new SQLDataSetCommand("select * from Test;", conn);...
4
3675
by: Rookie | last post by:
I have two C# VS .Net 2003 projects that compile and execute correctly on their own. I would like the second project to launch from within the first project. Therefore, I added the second...
1
2502
by: CA | last post by:
I am having a problem getting a pointer to an existing running Excel process on a client machine. Here are some details: 1) I have tested out the code on the development machine and it works...
5
8903
by: Greg Collins [MVP] | last post by:
I have an ASP.NET page that uses a tag: <asp:Xml id="foo" runat="server" DocumentSource="rss.xml" TransformSource="rss20.xsl" /> This creates a Web page from an XML file that was generated by...
0
3236
by: WebDev2 | last post by:
I can't get AJAX.NET Pro to work. I keep getting a Compiler Error Message: CS0246: The type or namespace name 'AjaxPro' could not be found (are you missing a using directive or an assembly...
6
27007
by: antonyliu2002 | last post by:
Hi, guys, I am using Visual Web Developer Express 2005 for my web application. I wrote a simple class called MyTestClass.cs and put it in the App_Code folder. I compiled it to library from...
2
24992
by: m.a | last post by:
Hello, I have the following code which is an entity for a table in my database. but I am getting several errors such as: The type or namespace name 'ColumnAttribute' could not be found (are...
3
2890
by: =?Utf-8?B?QUEyZTcyRQ==?= | last post by:
With using System.Configuration why is ConfigurationManager.AppSettings generate an error? Why does the error resolve itself when, in addition to the using directive, I add a reference...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7133
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.