I'm trying to develop a plugin in nopcommerce. To do this I want to replace some of the core code out of nopcommerce.
I tried to inherit it via:
public class TryingNewProjectController : BasePluginController, Nop.Web.Controllers.CatalogController
{
///// CODE /////
}
Can someone tell me what I'm doing wrong ?
Error:
The type or namespace name 'Controllers' does not exist in the namespace 'Nop.Web' (are you missing an assembly reference?
It really does mean you are actually missing a reference to be able to use Nop.Web.Controllers.
And as you found out it was Web.Controllers.CatalogController.
So Nop.Web.Controllers was itself expecting the reference.
Related
I created a new Razor Class Library (using "dotnet new razorclasslib"). I then created a folder called Models in the new library and it contains a class with the following test code:
using System;
namespace TestLibrary.Models
{
public class TestModel
{
public string TestMethod { get; set; }
}
}
However, when I try to use this class from the web application project (by referring to it as TestLibrary.Models.TestModel) I keep being told that the TestLibrary.Models namespace doesn't exist. The exact error is:
The type or namespace name 'Models' does not exist in the namespace 'TestLibrary' (are you missing an assembly reference?) [TestApplication]
I'm assuming I'm missing something simple, just can't figure out what.
This issue was somehow related to the issue posted here: Razor Class Library MSBuild MSB4062 Error During Compile. Once that was resolved this issue went away.
I had created one Class library as BLL.Inside that one Class as ClsEmployeeMaster.
I want to use this library in my projet of Visitor Management.
when i was trying to add this as reff. then it added successfully but when I was start to Build then errors occurs as :
Error 5 The type or namespace name 'ClsEmployeeMaster' could not be
found (are you missing a using directive or an assembly reference?)
so What to do??
It is not enough to add a reference to your BLL. If you want to use the classes defined in your BLL you need to name them with the full namespace. Something like
MyCompany.MyBLL.ClsEmployeeMaster em = new MyCompany.MyBLL.ClsEmployeeMaster();
or you can simplify your typing with
using MyCompany.MyBLL;
....
ClsEmployeeMaster em = new ClsEmployeeMaster();
Open the class file that you have created.
Check the namespace written above the class.
for example
namespace MyCompany
{
class BLL
{
...
...
}
}
then add that namespace to your current .cs
using dllName.MyCompany;
On trying to build, all of a sudden (a couple of days since I worked on this project) I get:
"The type or namespace name 'IO' does not exist in the class or namespace 'OpenNETCF' (are you missing an assembly reference?)"
But when I comment out that line (using OpenNETCF.IO.Ports;), I get:
? OpenNETCF.IO.Ports.Handshake (multiple choices...)?
When I click that, the choices are two:
OpenNETCF.IO.Ports.Handshake
- and:
OpenNETCF.IO.Serial.Handshake
As the code in this unit deals with printing, I select "Ports" (rejecting "Serial" because of its yin/yanginess to "Parallel"). So it then adds back the using I had which it complained about (using OpenNETCF.IO.Ports)...and then it's back to the original err msg.
Yet I do have several OpenNETCF items in my References, namely:
OpenNETCF
OpenNETCF.Data
OpenNETCF.Drawing
OpenNETCF.Net
OpenNETCF.Phone
OpenNETCF.VisualBasic // I don't know why, this is a C# project
OpenNETCF.Web.Services2
OpenNETCF.Windows.Forms
OpenNETCF.WindowsCE.Forms
OpenNETCF.Xml
What could possibly cause this chicken-and-egg tail-chasing exercise in frustration?
Odder yet, I get, "The type or namespace name 'Windows' does not exist in the class or namespace 'OpenNETCF' (are you missing an assembly reference?)" pointing to this using in another .cs file:
using OpenNETCF.Windows.Forms;
...and yet that using is grayed out as being unused at any rate, but when I comment it out, I get a lot of other errors purportedly because it's gone, such as on this line:
IntPtr hwnd = OpenNETCF.Win32.Win32Window.GetCapture();
The type or namespace name 'Win32Window' does not exist in the class or namespace 'OpenNETCF.Win32' (are you missing an assembly reference?)
UPDATE
In another episode of "Well Flip My Bits!" I just now compiled, got those err msgs about not being able to reconcile this line of code with what is installed and configured, etc., scrolled up to see that the "using" it was supposedly missing was there, compiled again, and now it compiles fine. What the blue blazes?!?!?!?
This sounds like a problem you see when you are building a project for a "Client Profile" .net version while referencing assemblies that are not supported in client profile.
Try changing your project's build settings to use a .net framework version that is not "Client Profile".
One can use the namespace using inside class also, so consider moving it there, if there are classes that use both than use the full name as in OpenNETCF.IO.Ports.Handshake handshake = new OpenNETCF.IO.Ports.Handshake()
And for the class using namespace:
using System;
namespace MyNamespace
{
using OpenNETCF.IO.Ports;
//...
}
Is there a way to reference a certain class/interface/... by enclosing it with its namespace rather than a using directive "using namespace_name" ?!
As, I'm working on a website, which uses SAP .NET connector. I already added a reference for connector ddl, and while referencing its namespace "using namespace_name", or set class namespace to another one rather than connector namespace,
I got error regarding connector classes with that error message "The type or namespace couldn't be found, are you missing a using directive or an assembly reference?".
But while changing namespace name to connector namespace, everything is going well?!
// Set namespace to be IDestinationConfiguration interface namespace.
// Using this, everything is going well.
namespace SAP.Middleware.Connector
{
public class ConnectorConfiguration : IDestinationConfiguration
{
}
}
// Using that way; it's not working, and got an error regarding IDestinationConfiguration even it belongs to refernced namespace.
using SAP.Middleware.Connector;
public class ConnectorConfiguration : IDestinationConfiguration
{
}
So, connector types forced me to set namespace of class to their namespace!
Is this possible? If so, how?
I ran into this too and couldn't figure it out until I finally found the answer on a post at http://forums.sdn.sap.com/thread.jspa?threadID=1876430, the last line which said:
"Also, make sure your target framework is ".NET v4.0" NOT ".NET v4.0 Client" -- that way you get the System.Web namespace that is required."
My project was targeting 4.0 client target framework. Once I changed it to just .NET Freamework 4.0, all the references worked as expected.
Is this what you are after?
public class ConnectorConfiguration: SAP.Middleware.Connection.IDestinationConfiguration
{
}
You can write all your code without usings if you like, you just need to use the fully qualified namespace name for every class/interface where the using isn't used.
If you try this:
using SAPTEST = SAP.Middleware.Connection;
namespace TestNamespace
{
public class ConnectorConfiguration: SAPTEST.IDestinationConfiguration
{
}
}
If that works, but it doesn't work if you remove SAPTEST, then IDestinationConfiguration must be declared in another namespace too.
I am getting this error Error 4 The type or namespace name 'Sample' could not be found (are you missing a using directive or an assembly reference?) F:\oadmin\sea\Controls\Dlg.cs 11 7 Controls
here i added Samplein reference section,,,then i used it as Using Sample,,i dont know why i am getting this error
this is the class
namespace sample
{
public class Server
{
public class client
{
Bool sent = true
}
}
}
Can i share exe,,this Sample is an exe
Perhaps because your namespace is sample and not Sample?
So if your Dlg namespace is different it needs to have a using sample line not using Sample.
Or perhaps your class is in another project within your solution and you need to include the hierarchy of namespaces?
Your namespace "sample" is lowercase, but you are referring to it in uppercase "Sample" ...
EDIT: You Bool sent is internal, it cannot be accessed from outside of the assembly