In My c# windows form it has a error
The type or namespace name 'OperationContext' could not be found (are
you missing a using directive or an assembly reference?)
can any one explain me the reason??
OperationContext is a class defined in the assembly System.ServiceModel contained in the library file System.ServiceModel.dll
If you try to use this class you need to add the reference to the library through Project References and then add a
using System.ServiceModel;
in the file using OperationContext
because you didn't add the dll for access this class
read http://msdn.microsoft.com/en-us/library/system.servicemodel.operationcontext.aspx
you have to add System.ServiceModel dll
Related
I can't get to use GZipStream class in my C# ASP.NET 4.5 application.
I get the error:
The type or namespace name 'GZipStream' could not be found (are you missing a using directive or an assembly reference?)
I tried using using System.IO; but the System.IO.Compression is not available in the "Reference Manager" in visual studio. I right click on the object name to see if Visual Studio finds the relevant reference but it does not.
Any suggestions?
Need to add reference to System.dll assembly and using System.IO.Compression namespace.
MSDN: GZipStream Class
The namespace is not the same as the dll name,You need to add a dll reference to the assembly, System.IO.Compression.FileSystem.dll
I wanted to write credential for web services (I am using-VS 2008,Asp.Net Framework 3.5,Windows 2003 Standard Edition,SQL Server) like this
private Credentials credentials;
But i am getting error to this line that the type or namespace name 'Credentials' could not be found (are you missing a using directive or an assembly reference?)
I have used
using ExtentrixWS;
Still i am getting 'are you missing a using directive or an assembly reference?'
Regards,
You should not only add the "using ExtentrixWS" but also you should add the relavent dll to the references of the project. Then only the services of ExtentrixWS will be referrenced to your project.
I am trying to check a service in C#, I have added the System.ServiceProcess.dll
Although I get the error:
Error 2 The type or namespace name 'ServiceController' could not be found (are you missing a using directive or an assembly reference?) D:\App\Form1.cs 247 13 App
My code is as follows:
private void button13_Click(object sender, EventArgs e)
{
ServiceController sc = new ServiceController("Spooler");
if (sc.Status == ServiceControllerStatus.Running)
{
MessageBox.Show("The service is running.");
}
}
Do I perhaps need a "using" statement?
You need to add a reference to the System.ServiceProcess.dll
After that, you will be able to see it in Visual Studio, as one of the using statements you can add to your project:
Pro Tip: When you are trying to use a class from the .NET Framework and you get a message like:
The type or namespace name '...' could
not be found (are you missing a using
directive or an assembly reference?)
Lookup the type in the MSDN Library and look under the Inheritance Hierarchy section to find the Namespace and Assembly you need.
Inheritance Hierarchy
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.ServiceProcess.ServiceController
Namespace: System.ServiceProcess
Assembly: System.ServiceProcess (in System.ServiceProcess.dll)
Then ensure that you have a reference to the assembly and a using directive for the namespace (assuming you don't want to fully qualify the name).
Yes, at the top.
using System.ServiceProcess;
For me (Visual Studio 2012) it was not a default addition when typing in "using"
I had to add a reference and search through the assemblies for System.ServiceProcess. (I believe it is located in the .NET tab in older versions of Studio).
Hope this helps any future viewers!
I get that the MembershipProvider is in the System.Web.Security namespace. I have added a reference System.Web in my project, I've added a using System.Web.Security directive in my .cs file - but as you can see, VS2010 does not believe me:
The type or namespace name 'MembershipProvider' could not be found
(are you missing a using directive or an assembly reference?)
What am I missing here?
You need to add a reference to System.Web.ApplicationServices.dll.
This is mentioned in the MembershipProvider help:
Namespace: System.Web.Security
Assembly: System.Web.ApplicationServices (in System.Web.ApplicationServices.dll)
Google result of the day:
It is in the assembly System.Web.ApplicationServices.
Hi I'm having a problem implementing this method.
I have added using System.Management but the class still doesn't work.
The error is:
Error 7 The type or namespace name 'ManagementBaseObject' could not be found (are you missing a using directive or an assembly reference?)
You are probably missing the assembly reference to System.Management.dll. The using statement just brings names into scope, to save you typing the prefix: it doesn't actually add a DLL reference.
Right-click your project's References folder and choose Add Reference. Go to the .NET tab of the resulting dialog, select System.Management and click OK.
did you add System.Management.dll as a reference?
msdn tells us more about where to find ManagementBaseObject:
Namespace: System.Management
Assembly: System.Management (in
System.Management.dll)
Don't Forget to write using System.Management; after adding the reference some time this happens even after adding the respective assembly it shows the error.