views:

113

answers:

5

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?

A: 

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
+2  A: 

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

Steve
A: 

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.

cgreeno
+1  A: 

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
A: 

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.

kalkie
I cannot see this? Do you mean I have to create a new project first? Or just open up the website?
leen3o
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".
kalkie