Saturday, January 7, 2017

Convert to Web Application: "The name 'objectName' does not exist in the current context"

If you're updating an old project into a web application, select the solution in the Solution Explorer, and then select to Project -> Convert to Web Application in the top menu:


This will create .aspx.designer.cs files in your project.   But you may run into the following error next:

   "The name 'objectName' does not exist in the current context"

If so check that you have the namespace declared around your class in the .aspx.designer.cs file, the Convert to Web Application action doesn't always add it:

namespace My.Namespace
{

    public partial class Default

    {

You may also need to update the Page Directive's Inherit attribute to include the namespace:

<%@ Page ... Inherits="Default" %>

to

<%@ Page ... Inherits="My.Namespace.Default" %>

2 comments:

Anonymous said...

Keep websiteing stuff like this I actually am fond of it.

Anonymous said...

This terrifies on line casino operators, as it's troublesome and costly to recover from perceptions of 점보카지노 a high-priced slot product. But that is determined by} value transparency, which exists for many of the day-to-day purchases we make. That is, other than visits to the doctor’s workplace and presumably the auto mechanic, we know the value of most services before we resolve to pay for them. Anthony Frederick Lucas receives funding from the Sycuan Institute on Tribal Gaming and the University of Nevada, Las Vegas. Sign up for a Club Sycuan card right now and you’ll routinely turn out to be a Gold cardholder.