Question

I'm using in C# Windows Application, I have using

TempProWin --> For Windows Application Projects
TempProApp --> For Database and functionality like Class File using CSLA Method.

In TempProWin.frmLogin.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using  TempProApp;

private void frmLogin_Load(object sender, EventArgs e)
{
 UserLoginList oUserLoginList = UserLoginList.GetUserLoginList();
 cmbUserName.DataSource = oUserLoginList;
 cmbUserName.DisplayMember = "Select User";
}

But When I build this application, I got the following error:

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

I already include reference of TempProApp.dll from the path of D:\TempPro\TempProApp\bin\Debug

Was it helpful?

Solution

RightClick on TempProApp and Go to definition.

On the top most, you will see the dll name and its version. You can verify that whether you are using the same dll version or not.

OTHER TIPS

A spurious “The type or namespace name could not be found” build error can result if you have other build warnings.

I'd partially coded an asynch HTTP method, which was generating warnings about missing awaits. I planned to get the rest of the system building, then fix that.

But I started getting the above hard error. I've spent the last three hours trying to isolate its cause. I tried all the suggested fixes, quadruple checked names, etc., and even deleted and recreated the project that was generating the complaints. No change. It seemed strange to me that when I clicked Go To Definition on the offending type reference, VS 2012 could find it with no problem. WTF*

As a last resort, I commented out the code that was producing the warnings. This fixed the spurious error messages and the build succeeded.

So, if you've ruled out the other causes and you have other build warnings, try fixing those.

Be sure you have spelled correctly the namespace you want to include. Also the .dll referenced must have been successfully build.

One way to be always sure for both the above is to include the project you want to reference in your working project. This will also ensure that in every build of your working Project the referenced PROJECT re-builds too, so any changes made will take affect

On Solution Explorer->Right Click-> Add existing Project-> Select the Project you would initially Reference

On References->Add new Reference-> Select Projects Tab-> Select the Project you added

If the namespace you are using does not expose any public methods it can also cause this error. Confirm that the namespace you are using contains public methods in a public class.

I was facing teh same error while attaching Gamecenter Achievements, then i realized that i missed a classname.

using UnityEngine.SocialPlatforms;
using UnityEngine.SocialPlatforms.GameCenter;

maybe you are missing 1 classname too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top