views:

36

answers:

3

I create a new vs.net project and added all the files from a asp.net website project.

When I compile, it couldn't find a reference to a class.

In the AppCode the class was defined, but without a namespace.

So I added a namespace, and then on the default.aspx.cs (this is where the error was originating) I added the using statement.

The using statement was not picking up the namespace.

What could the issue be?

+1  A: 

If I were you, I'd start from scratch. Web site "projects" are very different from every other actual project type in Visual Studio, that it may not be worth the trouble of "converting".

I'd go as far as to create an empty project and starting over. You could copy and paste the .aspx and .ascx files, but any codebehind needs to be separately copied and pasted, possibly method by method.

John Saunders
i didn't convert it, i created a new vs.net from scratch but then copied and pasted all the pages/folders.
Blankman
I'm saying you won't get away with copying the C# or VB.NET code. It won't make sense in the new project. You've already hit the namespace issue.
John Saunders
A: 

To be honest it is a nightmare converting an asp.net web site project type to a regular project.

As per Saunders advice, better to start from scratch as it would take twice as more time to first convert and then fix-up your broken code.

Asad Butt
+1  A: 

Its more likely a duplicate or double compile of the file, AppCode folder gets built by ASP.NET background compiler and when you build the project explicitly the type is created again hence a duplicate type is generated. If you use Visual Studio's convert to web application method then AppCode is renamed to Old_App_Code by default. Check this link for converting web site to web app project

http://msdn.microsoft.com/en-us/library/aa983476(v=VS.100).aspx

Kiran Bheemarti