问题
I just upgraded to VS2008 Sp1, and I have a weird issue going on. I get a lot of errors from my code behind pages indicating that a control doesn't exist in the current context and I am also getting an errors that the pages do not have methods.
It seems like ide is trying to compile the c# code without compiling the aspx code.
The site runs fine via both IIS and Visual Web Developer, and in fact when I open up the code behind page, all the errors go away. Anyone have any idea why VS2008 SP1 is behaving this way?
I am using C#, and the Web Site project mode.
回答1:
Check to make sure you are targeting the correct version of the .NET Framework. You can view this in the properties of the Solution file.
VS2008 allows you to target multiple framework versions.
Also check the Web.config, I know there can be differences between VS Web Developer and VS Standard/Pro with the web config. Maybe copy a fresh web.config file into the project.
回答2:
There is a KB Article and Hotfix for what sounds like might be my issue. I'll test this and update my answer if it was my specific problem but the behavior matches. I need to improve my google skills..should have found this via google.
This patch resolved my issue, weird
来源:https://stackoverflow.com/questions/658490/web-site-reports-xxx-does-not-exist-in-current-context-after-upgrade-to-vs2008-s