0

I have converted my old VS2008 Website to Web Application, now everything was working before I tried to convert it. But now I don't seem to be able to reference my Classes? For example I have a BasePage class that every .aspx page inherits like so

public partial class SomePageName : BasePage
{
}

But now I get this message? And the same for all the other classes?

The type or namespace name 'BasePage' could not be found (are you missing a using directive or an assembly reference?)

How do I find out which 'using' directive I am missing and whats an assembly reference?

YodasMyDad
  • 9,248
  • 24
  • 76
  • 121
  • Where are your classes defined? Separate project / assembly? App_Code folder? The solution to the problem will depend on your answer. – Saul Dolgin Jul 24 '09 at 12:42
  • My classes are in the App_Code folder? Any help would be really appreciated with this its driving me nuts :( – YodasMyDad Jul 28 '09 at 17:25

6 Answers6

2

The conversion namespaced your classes. Perhaps it should be NewlyAddedNamespace.BasePage?

Steve
  • 5,802
  • 12
  • 54
  • 76
1

Locate the class BasePage in your project using the object explorer.

In object explorer you will be able to see the complete name Something.Somethingelse.BasepAge

Do mass search and replace to the complete name.

ggonsalv
  • 1,264
  • 8
  • 18
0

In Solution Explorer (available on the View menu if you can't see it), you will see that your web application contains a node marked "References". Right click on this and choose "Add reference", and when the dialog box appears, on the Project tab you be able to add a reference to the other project which defines this BasePage class. This then becomes an assembly reference when compiled.

You probably already have the using statement you need from before. Previously, this would have been picked up by the presence of the necessary DLL in the bin folder of the web project. It works differently for a web application.

David M
  • 71,481
  • 13
  • 158
  • 186
0

How to convert in a Web Site Project - will get you started - it is for VS2005 but will still be applicable for Visual Studio 2008.

You might want to take a look at the difference between the 2 types of projects. That said, website projects generally are not created with namespaces, I would guess that "BasePage" was in you appCode folder and has now been converted into a different namespace. You just need to line you your namespaces and everything should work correctly.

Community
  • 1
  • 1
cgreeno
  • 31,943
  • 7
  • 66
  • 87
0

What you could try is "Convert to Web Application" in Visual Studio. It is available in the context menu of the new Web Application project in Visual Studio.

Patrick
  • 514
  • 4
  • 14
  • I cannot see this? Do you mean I have to create a new project first? Or just open up the website? – YodasMyDad May 04 '10 at 06:07
  • No, that's the strange thing you have to create a new web application project first, copy your pages etc, and then on the context menu of your new web application choose "Convert to Web Application". – Patrick May 04 '10 at 08:21
0

There's another possible issue. You might need to set the "Build Action" to "Compile instead of Content. Right-click the .cs file, bring up the properties and make sure the Build Action is compile.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Ripside
  • 145
  • 2
  • 8