简体   繁体   中英

Visual Studio Cannot Find .cs

I am just starting to learn ASP.NET (C#) and I am struggling with a tutorial I am working on.

I have my App_Code Folder and within it, I have a folder called DataAccessStuff. Within this folder are a bunch of .cs files I will be using for the data layer of things.

The problem is, Visual Studio is unable to detect the location of these .cs files and gives me the error:

"The type name "DataAccessStuff does not exist in the type 'System.Web.UI.WebControls.Content"

I have no idea how to get it to recognize. I simply copied the project file from the textbook CD onto my computer as it said. I have attached images showing the precise tree layout of the project as well as the code I am using. If anyone can please help a beginner out, it would be appreciated.

Thanks!

在此输入图像描述

在此输入图像描述

Inside one of the .cs files

在此输入图像描述

The namespace is probably

Content.DataAccessStuff

based on the root name of your project. However, if you simply double click the file in DataAccessStuff that you want to access, it will give you the namespace of the file.

EDIT: Since this is a Web Site Project, not a Web Application Project, namespacing is by default not explicit unless added.

Make sure anything referencing something belonging to the folder Content.DataAccessStuff has a

using Content.DataAccessStuff;

at the top of the class with the rest of your using statements.

The following article does an excellent job highlighting some of the key differences between Web Site Projects and Web Application Projects.

http://msdn.microsoft.com/en-us/library/dd547590.aspx

Check the namespace provided in all the class (.cs files) of 'DataAccessStuff' folder.

It should be 'Content.DataAccessStuff'.

使用lab6.DataAccessStuff而不是Content编写。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM