I am working on a rather large website project in Visual Studio 2010 and I'm wondering why changes in the code are reflected when I test a web page individually (by right-clicking the .aspx
file and selecting View Changes in Browser
), even though there are errors in the code that prevent it from compiling. This confuses me. I am getting several errors when I run the code in Visual Studio. However, any change that I make, either in the client side code or the server side code, is reflected if I just view the page in the browser. This makes sense for client side code and markup, but why does it even take the "flawed" server side code? Doesn't server side code need to be compiled? Thanks for any input. I have many more questions on this topic, but I'm hoping the answer to this question helps me answer the other questions I have.
EDIT: Further information on the errors I'm getting
I have learned some more details from the original developer assigned to this project. He has informed me that, for every additional feature that he built in to the project, he copied and pasted the original project directory and renamed the folder. For instance, this is the original project directory:
App_Code [folder]
App_Data [folder]
Web.config [file]
...
He copied this every time he built a new "module" into the website. This is certainly not the way that I would have done it, but it has already been done now. As it stands, there are 4 copies of this original project directory, which means there are 4 web.config
files, 4 App_Code
and App_Data
folders (and 4 copies of the classes in the App_Code
folder). The errors I'm getting are things like these: [server control] is not declared. It may be inaccessible due to its protection level
, and [server control] is not a member of [partial class]
, among a few others that would certainly alert intellisense if they were, in fact, errors. It seems that, for some reason, the server controls on each of my webpages are not correctly linked to the corresponding code-behind file. But intellisense does not highlight these errors or acknowledge them in any way. I get these errors when I try to build the project. I have tried to expose the designer code file to try to fix these errors manually, but I learned that you cannot do that in a Website
project. I am honestly at a loss.
If anyone has any idea how to fix this, please let me know. If I can be more clear, please tell me. I can't include any actual code, but I can try to give you some examples if that would help.
Here is another question that seems to be similar to mine. Even the number of errors that Visual Studio reported is the same. variable is not declared it may be inaccessible due to its protection level
Configuration Manager
set to compile the website code files when you press F5? Is the compilation error you mention in the file you are working on or a different file? – SolemnityConfiguration Manager
is set to not compile on build? Also, can you provide a sample so I can replicate this? – Solemnity