Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellisense missing in App_Code, for bin dlls in Website Project

Any classes I create in the /App_Code or /App_Code/[subfolder] don't have local intellisense.

That is - I have intellisense for system dlls such as string.[member] etc. But cannot get it to recogize any classes local to App_Code (including itself), or dlls referenced in the /bin folder.

Although I do have intellisense of inside the scope of a member-function. (ie. local variables or function parameters)

NB

  • This is a Web Site project, not a Web Application project.
  • I have tried resetting all the Visual Studio settings and clearing the intellisense information found in AppData for VS.
  • Im working with Visual Studio 2012 ver. 11.0.61030.00 Update 4
  • The project is using .NET 4.0
  • If I move the classes outside of the App_code folder, they register in intellisense perfectly.
  • There is no option to set the Build setting of the files to Compile as this is a web site project rather than a web app.
like image 651
Jono Avatar asked Apr 29 '14 13:04

Jono


2 Answers

IMO, you should move your code out of App_Code. In .net 4.5 (and 4.0) your behind code is compiled to a dll, so I don't see any benefits to putting your code in App_Code. If someone advises different, I am interesting in hearing.

With that said, create a folder or folders under your root project and put your code in there.

MyWebsite
 - DataLayer
     MyDataLayer.cs
Default.aspx

In this example, you will be able to access your classes DataLayer.MyDataLayer

Even better create a new library for code that is not needed in your aspx.cs code behind files.

like image 152
PhillyNJ Avatar answered Oct 06 '22 10:10

PhillyNJ


New code files in App_Code will have the build action "Content", hence you got no intellisense. So right click your code file and click "Properties", in the property window change the "Build Action" to "Compile".

Then reopen your code file.

like image 23
Martin Braun Avatar answered Oct 06 '22 10:10

Martin Braun