Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellisense in App_Code in VS2010

I've just upgrade my web application from vs2008 to vs2010, I create a new web app from vs2010, then copy across all the existing files from vs2008, then I add a new class file to App_Code folder, the intellisense is not showing up for everything and class etc is also not color in the right color. However, when I open the existing class I created earlier from vs2008, intellisense just working fine and all classes are in different color as well, if I make a copy of existing class, the copied class does not support the intellisense as well. However, if I shut my VS, and reopen it, they all appear to be support with intellisense for existing class, but once I created a new class, intellisense is not support.

Can you tell me what's wrong here? Thanks

like image 783
nikok Avatar asked May 19 '10 00:05

nikok


2 Answers

Check if your classes build action is set to Compile (right click on your class in solution explorer and click properties).

Apparently when you add classes to the App_code folder it sets the build action by default to Content.

From a post by Microsoft on 8/19/2008 in connect.microsoft.com in regards to a bug report on this issue

Thanks for the feedback. This is actually by design in Visual Studio. App_Code is not supported in Web Application Projects--only in Web Sites (due to architectural reasons). When you add a class file to the App_Code folder, the file is added as "Content" as opposed to "Compile" and you should not get intellisense on it. So when you move it out of your App_Code folder, it will remain as "Content" type and not get compiled, and thus continued no intellisense. To fix this, move the file outside of App_Code, select the file, and change the build action to "Compile" in the property grid.

Thanks, - The Visual Web Developer Team

Note that although in the post it says to move the file out and change the build action, you don't have to actually move the file, you just need to change the build action.

like image 173
Jack Avatar answered Dec 26 '22 03:12

Jack


Follow this Process :-

  1. Right click on the .cs file and click on properties.
  2. You can find "Build Action" Property in Properties window. It is by default selected to the Content. Change this to Compile option.
like image 33
Sandeep Tawaniya Avatar answered Dec 26 '22 04:12

Sandeep Tawaniya