No auto generated fields in code behind

I

Iluvatar

Hi,

last week our project upgraded from vs.net 2005 to vs.net 2008. Our
project still uses framework 2.0, because the deployment servers are
not 3.x ready yet. Everything so far while migrating the solution and
project files worked fine.

Today, I tried to add new controls to an existing web form. The markup
doesn't show any errors, but in the auto generated code behind
(*.aspx.designer.cs) I am missing the declartion of the added control
and the control is not available in code-behind.
The same applies when adding controls to a existing web control and
also when doing the same with new forms or controls.

Second, I tried the same with a new web project and everything is fine
- using framework 2.0 and 3.5. Is there some kind of setting I have to
do on the solution to reactivate auto-generating of the fields?

Kind regards,
Michael
 
M

Mark Fitzpatrick

Michael,
I don't think it's the 2.0 to 3.x issue, I think it's the difference in web
projects between vs 2005 and 2008.

VS 2005 originally shipped with the web site project as the sole way to
create a web site. It did not create any designer files and did not compile
all the site to a single dll. Instead it would do it more at runtime and
create lots of dlls for the directories and pages individually. An add-in
was created to create a Web Application Project, which would let you create
a project that would compile into a single dll and this project type creates
designer files. This add-in was later rolled up into VS 2005. It could be
that this project is being treated as a web site project, or was originally
created as a web site project and not a web application project. The issue
you are experiencing would be the normal behavior for a web site project. If
it is a web application project, try right-clicking on one of the .aspx
pages that has a code behind file but not a designer and look for a Convert
to Web Application entry. This should parse it and create a designer file.
You may want to check out the project itself first though to ensure it is a
web application project (you can usually tell when you compare the project's
properties dialog).

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
 
I

Iluvatar

Hi Mark,

thanks for your help. Converting the controls/forms to web application
solved the problem.

AFAIK, the project started under VS.NET 2003 and then was migrated to
VS.NET 2005 some years ago. So it was originally of course a web
application project. For some reasons migrating to VS.NET 2005 worked
fine, migrating to VS.NET 2008 not :-(

Kind regards,
Michael
 
I

Iluvatar

For all those with the same problem:
The solution presented by Mark solved the problem for the moment. But
when coming back to the control and again editing it, the same
misbehaviour occurred again. Once, I again tried to convert a control
to a "Web application" and I got the following error message:
"Unable to launch the ASP.NET Development Server because Port '2288'
is in use."

Ugh... I stopped the web server and tried it again. Fine it worked.
Then I started the webserver again and tried to add another control.
Nothing happened to the declarations in the *.desinger.cs. I stopped
the webserver and tried to add it again. Guess, what happened... yes,
the new contorl got declared.

Finally I have to say, that somehow the WebDev Webserver shipped
with .NET 3.5 seems to lock files. Whenever I try to edit a file under
sourcecontrol (TFS) and the webserver is running, it does not get
checked out automatically. When I try to save it then, I get an error
message that the file is write protected. When the webserver is not
running, all works fine.

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top