473,379 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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 4791

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
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
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
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
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
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
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
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
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
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.