B
Bennett Haselton
If I create a new C# Web Project in Visual Studio and add this to the
Page_Load method for WebForm1:
Response.Write("firsttime");
then hitting F5 to debug the project of course shows the WebForm with
"firsttime" on the page.
But if I then change it to Response.Write("secondtime") and hit F5,
the changes don't take effect -- the WebForm still opens and displays
"firsttime". Even if I do "Build->Build Solution" and then hit F5,
the WebForm still displays "firsttime". It's only if I do
Build->*Rebuild* Solution and then debug, that the changes take effect
and I see "secondtime".
I haven't used Visual Studio much before doing ASP.Net but this seems
inconsistent with the way all other kinds of projects work. In
general, if you modify one of the source files and hit F5, the changes
take effect -- the source is saved and the necessary parts of the
project are rebuilt automatically. Is there some reason why ASP.Net
projects don't work this way? Some setting I can change so that
changes take effect when I hit F5?
The other way to make the changes take effect right away, is to
declare a new variable like "int x;", even if you never use it. If
you do that, the WebForm will display whatever you've modified
Response.Write() to write, even if you don't do Rebuild Solution
first. I guess this is why I didn't notice this problem until now,
since most of the time, the changes I made would be substantial enough
that the relevant parts would be rebuilt when I wanted to debug.
-Bennett
Page_Load method for WebForm1:
Response.Write("firsttime");
then hitting F5 to debug the project of course shows the WebForm with
"firsttime" on the page.
But if I then change it to Response.Write("secondtime") and hit F5,
the changes don't take effect -- the WebForm still opens and displays
"firsttime". Even if I do "Build->Build Solution" and then hit F5,
the WebForm still displays "firsttime". It's only if I do
Build->*Rebuild* Solution and then debug, that the changes take effect
and I see "secondtime".
I haven't used Visual Studio much before doing ASP.Net but this seems
inconsistent with the way all other kinds of projects work. In
general, if you modify one of the source files and hit F5, the changes
take effect -- the source is saved and the necessary parts of the
project are rebuilt automatically. Is there some reason why ASP.Net
projects don't work this way? Some setting I can change so that
changes take effect when I hit F5?
The other way to make the changes take effect right away, is to
declare a new variable like "int x;", even if you never use it. If
you do that, the WebForm will display whatever you've modified
Response.Write() to write, even if you don't do Rebuild Solution
first. I guess this is why I didn't notice this problem until now,
since most of the time, the changes I made would be substantial enough
that the relevant parts would be rebuilt when I wanted to debug.
-Bennett