Re: Getting namespace errors on compile



tshad wrote:
I have a file that I converted from VB.Net to C# that works fine in VB.Net when I compile but not in C# using the same libraries.

The error I am getting is:

PageInit.cs(9,7): error CS0138: A using namespace directive can only be applied
to namespaces; 'System.Web.HttpCookie' is a class not a namespace

The code is:
**********************************
using System;
using System.Web;
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.SessionState;
using System.Data;
using System.Data.SqlClient;
using System.Web.HttpCookie;
^^^^
Have you tried removing the offending using directive?

Try and remove it and see if that fixes it.

<...>

JB
.



Relevant Pages

  • Re: I really hate .NET especially inside Delphi
    ... in Delphi.NET terms this is a package (yeah, yeah, I don't know why ... to a BPL it will compile to a dll, ... will see a namespace called TimsTest with TTestClass in it, ... in a Delphi app in the Uses class you would put ...
    (borland.public.delphi.non-technical)
  • Re: custom namespaces
    ... and for which I think I must need to compile ... it so that the code behind can actually see/find reference to the custom ... I'm trying to create custom a namespace for use ...
    (microsoft.public.dotnet.framework.aspnet)
  • static class members, shared libs and other vegetables
    ... libraries, and load the two sets separately. ... The solution doesn't work on Linux, as static members for some reason ... namespace, compiling it, changing the namespace and compiling the code ... script or switch to compile all code under a single namespace. ...
    (comp.os.linux.development.apps)
  • Re: Weird bug in VS.NET 2003 IDE
    ... > From time to time, when I save my code, the IDE decides to add lines to ... > End Sub ... > End Namespace ... > the IDE adding all these lines is that the program fails to compile, ...
    (microsoft.public.vsnet.ide)
  • Re: How to pass information, classes between forms in Windows Application mode [ FINALLY!]
    ... declarations, it will compile. ... [that Namespace only gets rid of ambiguity in class names, ...
    (microsoft.public.dotnet.languages.csharp)