Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with namespace

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
I am trying to play around with an XML Menu system that I found and when I try to view the page I am getting this error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'XmlHierMenu' could not be found (are you missing a using directive or an assembly reference?)

Source Error:



Line 1: <%@ Page language=&quot;C#&quot; %>
Line 2: <%@ Import Namespace=&quot;XmlHierMenu&quot; %>
Line 3: <html>
Line 4: <head>


Source File: E:\Intranet\Mystuff\Mystuff\ASP+Menu\createMenus.aspx Line: 2

What does this error mean, and how would I fix it?
 
Most likely, you have not included the .dll file for the assembly in your &quot;References&quot;.

Just look up there close to the top of the tree in VS.NET, and you'll see the references folder. Right click --> Add Reference:

Browse to the location of the .dll on your computer, and add it.

You should then have no problems referencing the namespace in the files w/in that project. Note that for each project you wish to use an external assembly, you must do this.

good luck! :)
paul
penny1.gif
penny1.gif
 
Then check the documentation for the control. If its telling you to reference a namespace to get it working, then there should be some sort of code file that holds the reference. Now, that may not be a dll. It could be just a .cs file that has all the classes (usually they are dll's, but they don't have to be. All the classes for our web app are in code files, not dll's).

If this is the case, then you just need to add the code file to your project (I'm assuming you're using vs.net right?), and then it'll work.

hth
Jack
 
actually I have barely used VS.NET but I do have it. I have been using Dreamweaver MX to edit files. I know there is a .CS file that has a bunch of classes in it.
 
Kewl, how do you find MX works for creating asp.net apps?

The .cs file is what you need to add to your project then. Once its part of it, you should be able to access the classes/namespace without any problem.

Let us know how it goes.

jack
 
It is in the folder where the aspx file is. How do you add it to the project???
Dreamweaver is a great program that is slowly taking on the ASP.NET world. I find that dreamweaver is really geared towards coldfusion because Macromedia owns it. Dreamweaver does offer intellityping for ASP.NET but offers very little support for somethings in .NET like code behind pages and things like that. Basically what I have read is that some people like dreamweaver for the design layout and VS.NET for the coding of ASP.NET. My problem is that VS looks so intimidating. I am just trying to learn .NET as we speak and choose dreamweaver because I felt comfortable in it. One thing in VS that I can't figure out is how to make my projects reside on my server with IIS instead of my local machine. Basically everything I develop for is on the server and not on my local machine. Have you looked at Web Matrix??? I haven't decided whether to download it or not.
 
Kewl, how do you find MX works for creating asp.net apps?

The .cs file is what you need to add to your project then. Once its part of it, you should be able to access the classes/namespace without any problem.

Let us know how it goes.

jack
 
sorry about that duplicate post there.
:)

I havn't looked at WebMatrix, mainly because i have vs.net at work. since asp.net is VERY different coding wise from classic asp, it would be a good idea to get your hands dirty with vs.net. It may look intimidating, but really its not that bad.
:)

In fact, there's a Wrox book out there that deals exlusively with using visual studio.net. The name escapes me, but if you check the wrox site I'm sure you'll be able to find it.

As for adding the .cs file to the project, I can tell you how to do it in visual studio.net, but I really have no clue if MX handles it the same way or not. Here goes though:

- in visual studio, the project is shown as a node-tree (much like previous visual studio versions). All you do is right click on teh project file and select Add Existing File, or a subordinate folder and do the same thing (wherever you want to put the file). Now, in VS.NEt when you do this, the project file (which holds data regarding which files are part of your project) gets written to automatically, so the project then knows that it can access whatever namespaces/code is held within the new file.

Try it in MX and see if it works. If not, then like you said: get the look and layout done, but switch to vs.net when you're ready for the coding.

hth

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top