Why is the show all files button disabled in the solution for my Web project?
I attempted a conversion of a 1.1 site that the converter destroyed so now I am trying to piece things back together. One thing is that all of my form objects are undefined in the codebehind (now codeFile). So if I have a text box called Text1 I get an
error "Text1 is undefined" in the codeFile. I really HATE when things are generated behind the scenes and hidden from me and this is a primary reason. At least in 1.1 it showed you all the crap it generated for you. How the hell am I supposed to know what's
gone wrong when the compiler is generating stuff that I can't see nor get to? In searching for an answer I see all these refereces to the "Show All Files" option on the project/solution menu. Well the button for "Show All Files" is disabled on all my projects
so what now?
Thanks, and sorry I'm just a little aggravated at the moment.
I'm sorry you are having these problems. First off (and this is advice to others) -- always make a backup! It just makes good sense whenever you run a program which will modify the source code of your project.
In the Web Site Project (WSP, the default web project in VS05 RTM), all control variables are generated in a hidden class which exists in memory. This is possible since in VS05 both C# and VB supports partial classes, and allows
us to separate auto-generated code such as control variables from user code -- this is a good thing in general.
"Show All Files" is grayed out since it is not needed in a WSP -- all files are already shown in the Solution Explorer. Since the hidden class is not a file, it is not shown.
I do admit it would be nice to see these hidden variables when you are trying to find a troublesome bug or you really want to know what is happening. Unfortunately, there is not an easy way to do it. However, you can trigger
a run-time error which will show the temp file created from the hidden class which will allow you to see what is generated.
Open the code-behind file containing the partial class that you want to see the control variables created for. Let's assume it is Foo.aspx.cs and you have added a Label called "Label1" in Foo.aspx.
In the Page_Load(), add some code that will not compile, e.g.
Label2.Text = "foo"; // this assumes that Label2 does not exist in Foo.aspx
The trick now is to run this in IE without validating the page first. By default, when you press F5, VS05 will compile the page to validate it, and if it compiles fine it will run the page in IE. We want to skip the validation
step. So instead, just go to the Solution Explorer and bring up the context menu for Foo.aspx and say "View in browser".
This will run the page in IE. You will get an error like
Compilation Error Message CS0103: The name 'Label2' does not exist in this context.
Under this error, you should also see the command "Show Complete Compilation Source"
Select this command and you will see the temp file generated from the hidden class. You will find a line like this:
protected global::System.Web.UI.WebControls.Label Label1;
Ok, so the autogenerated code doesn't exist in a file, that is unfortunate but good to know. So how do I go about solving the fact that my controls in the aspx file aren't being generated in the magic hidden code? Is there a way to force the magic code to
try again to regenerate itself? I suppose I could just dim them all in the code behind like in 1.1.
That would be a bug. Could you create a simple reproducible case and send it to me as a zip file? You can send it to m b u n d @ m i c r o s o f t . c o m
I had the same problem, but I found why this could happen (for me at least).
In VS2005, if you choose File > new > new website. The result will be a project with a website on it, BUT you will not see the designer files.
BUT, if you use File > new > project > asp net web application ... The result will be a project with a website on it, BUT in this case you will see the designer files.
I don’t have the option to select an asp net application. Is it under the templates section or under the main projects... Also I am using VS team addition.... What Version of VS are you using…
rmelancon
Member
177 Points
55 Posts
Show all files is disabled
Apr 13, 2006 07:09 PM|LINK
Why is the show all files button disabled in the solution for my Web project?
I attempted a conversion of a 1.1 site that the converter destroyed so now I am trying to piece things back together. One thing is that all of my form objects are undefined in the codebehind (now codeFile). So if I have a text box called Text1 I get an error "Text1 is undefined" in the codeFile. I really HATE when things are generated behind the scenes and hidden from me and this is a primary reason. At least in 1.1 it showed you all the crap it generated for you. How the hell am I supposed to know what's gone wrong when the compiler is generating stuff that I can't see nor get to? In searching for an answer I see all these refereces to the "Show All Files" option on the project/solution menu. Well the button for "Show All Files" is disabled on all my projects so what now?
Thanks, and sorry I'm just a little aggravated at the moment.
Robb
mbund
Member
630 Points
126 Posts
Microsoft
Re: Show all files is disabled
Apr 13, 2006 08:12 PM|LINK
I'm sorry you are having these problems. First off (and this is advice to others) -- always make a backup! It just makes good sense whenever you run a program which will modify the source code of your project.
In the Web Site Project (WSP, the default web project in VS05 RTM), all control variables are generated in a hidden class which exists in memory. This is possible since in VS05 both C# and VB supports partial classes, and allows us to separate auto-generated code such as control variables from user code -- this is a good thing in general.
"Show All Files" is grayed out since it is not needed in a WSP -- all files are already shown in the Solution Explorer. Since the hidden class is not a file, it is not shown.
I do admit it would be nice to see these hidden variables when you are trying to find a troublesome bug or you really want to know what is happening. Unfortunately, there is not an easy way to do it. However, you can trigger a run-time error which will show the temp file created from the hidden class which will allow you to see what is generated.
Label2.Text = "foo"; // this assumes that Label2 does not exist in Foo.aspx
Compilation Error Message CS0103: The name 'Label2' does not exist in this context.
protected global::System.Web.UI.WebControls.Label Label1;
HTH!
rmelancon
Member
177 Points
55 Posts
Re: Show all files is disabled
Apr 13, 2006 10:24 PM|LINK
mbund
Member
630 Points
126 Posts
Microsoft
Re: Show all files is disabled
Apr 13, 2006 11:52 PM|LINK
That would be a bug. Could you create a simple reproducible case and send it to me as a zip file? You can send it to m b u n d @ m i c r o s o f t . c o m
Thanks!
rmelancon
Member
177 Points
55 Posts
Re: Show all files is disabled
Apr 14, 2006 12:56 PM|LINK
Just FYI I sent a zip file with the offending code.
Thanks,
Robb
cgreeno@gmai...
Member
4 Points
2 Posts
Re: Show all files is disabled
May 21, 2007 10:17 PM|LINK
This Link shows a aspx.designer.cs file
http://webproject.scottgu.com/CSharp/UnderstandingCodeBehind/UnderstandingCodeBehind.aspx
There must be a way to see it it cant just be in memory... how is it being displayed in this solution?
Thanks
Selecters
Member
4 Points
2 Posts
Re: Show all files is disabled
May 28, 2007 08:47 AM|LINK
My first post on this forum :)
I had the same problem, but I found why this could happen (for me at least).
In VS2005, if you choose File > new > new website. The result will be a project with a website on it, BUT you will not see the designer files.
BUT, if you use File > new > project > asp net web application ... The result will be a project with a website on it, BUT in this case you will see the designer files.
Selecters
Member
4 Points
2 Posts
Re: Show all files is disabled
May 28, 2007 08:48 AM|LINK
sorry, double post
cgreeno@gmai...
Member
4 Points
2 Posts
Re: Show all files is disabled
May 28, 2007 10:13 AM|LINK
I don’t have the option to select an asp net application. Is it under the templates section or under the main projects... Also I am using VS team addition.... What Version of VS are you using…
rajanam
Member
185 Points
67 Posts
Re: Show all files is disabled
Jul 09, 2007 07:47 PM|LINK
Since the 'Show All Files' icon button is disabled is there a way to hide the files 'Exclude(d) from Project'?
Thanks.