Search code examples
c#visual-studio-2012intellisensevs-web-site-projectapp-code

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.

Solution

  • 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.