'GZipStream' could not be found - reference issue - c#

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

Related

CS0246: The type or namespace name 'MySql' could not be found

how i can fix this problem??
help me
Compiler Error Message: CS0246: The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?)
Line 1: using MySql.Data.MySqlClient;
Apologies if this is not the case but working on the assumption that you're developing in a version of Visual Studio, check the project references.
If MySql.Data exists in the references but has the warning (yellow triangle) indicator next to it then you may need to re-reference the .dll from its location in your filesystem.
Alternatively, you can grab this from the Nuget package manager if it is not available locally.
Despite the full namespace qualification, the library must be correctly referenced for the object namespace to be recognised in the IDE.
Let us know what IDE you're using if not VS.

missing a using directive or an assembly reference OperationContext

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

The type or namespace name 'ServiceController' could not be found

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!

Added project to VS 2008 solution; created dependency; getting compiler error CS0246

This is probably a very basic error on my part. Here's what I did:
Created a new C# Smart Device Project in Visual Studio 2008.
Added a C# project (Bouncy Castle) to this solution.
Created a dependency: my Smart Device Project depends on crypto, the Bouncy Castle project.
Added some using statements to my project:
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Utilities.Encoders;
Compiling the project gives me four CS0246 errors:
The type or namespace name 'Org' could not be found (are you missing
a using directive or an assembly reference?)
I pulled the C# code into the project directly, so I don't know what I'm missing.
Thanks!
Created a dependency
Nobody ever says that. Which I'd have to guess is the source of the problem, you "add a reference". Project + Add Reference.

ManagementBaseObject not found

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.

Categories