littlecharva

Hi,

I've done a good search on Google and on here and tried many of the solutions to fix a faulty Intellisense, but I get the feeling it's me that's doing something wrong rather than the Intellisense.

I've just started using VS2005Pro as my IDE for editing my .cs Code Behind files after using TextPad before. I made the change as I want the benefit of Intellisense.

I don't have my site set up as a project, I'm just editing each .cs file on it's own, as I don't want to hand anything else over to VS.

So I've created a new .cs file, and I've started typing: using System. and Intellisense pops up to give me options. Unfortunately not everything I want is in the Intellisense list. Collections, IO, Runtime and others are available for me to select, but Data, Net, Web, Windows and a load of others are missing.

This means that when I get into my code and I start using DataSet objDS = new DataSet( - I get no Intellisense either, although I do with things like strMyString.Replace( .

If this were a VS Project I'd try something like adding a reference, but since I'm editing a single file, I don't know where I'd start with that.

Can I just add that the code works fine when tested on my webserver, it's just the Intellisense that doesn't work.

Any ideas

Littlecharva




Re: Visual C# IDE Intellisense only working on some Classes and not others

NewWorldMan

I'm surprised it works at all actually. I think you'll have to work with a full project.





Re: Visual C# IDE Intellisense only working on some Classes and not others

littlecharva

The reason I'm avoiding using a full project is because the webapp I'm working on has been developed throughout the years and has a combination of ASP and ASP.NET files, it's a bit unweildly enough without VS adding extra files into the equation.






Re: Visual C# IDE Intellisense only working on some Classes and not others

TaylorMichaelL

Intellisense is based off the references that you have. If you don't have a project open and/or don't include a reference to the assembly then IS won't display anything. Honestly you should use VS projects and not try to work around the system. Is there any particular reason why you don't trust VS with your project code. Given all the capabilities including automatic recompilation, debugging, project management, reference management and deployment options I don't really understand why you fear it.

Nevertheless you can create a temporary project, drag and drop your CS file into the project and then add any additional assembly references to the project. This will give you access to IS. By default System.Data will be included (and hence IS works) but System.Web and System.Windows.Forms will have to be added as a reference. Also note that you classes for which you create and reference (either directly or through an assembly) that uses XML commenting will also be picked up by IS provided you generate the documentation file and VS can find it.

Michael Taylor - 1/30/07
http://p3net.mvps.org





Re: Visual C# IDE Intellisense only working on some Classes and not others

littlecharva

Right, I've bitten the bullet and set up a solution for my webserver in VS2005, the intellisense is now working and I'm really pleased. I had the fear that it was going to add loads of un-neccessary files to my server, but it hasn't.

I have a couple of further questions though:

Is there a way to tell VS where to create code behind files My system is to create a folder called CodeBehind and keep the file in there, for example:

MyNewWebpage.aspx
CodeBehind/MyNewWebpage.cs

Will I forever be renaming and moving my files, or is there a way to tell VS to do it this way

My webserver is running on a Windows 2000 server, how do I implement debugging when the files are stored and served on a different machine

Thanks,

Littlecharva






Re: Visual C# IDE Intellisense only working on some Classes and not others

TaylorMichaelL

Yes and no. Codebehinds are associated on a per page/control basis and therefore should reside in the same directory as the ASPX/ASCX file. However all support code (i.e. non-codebehind) will be automatically placed in the app_code directory in ASP.NET v2 if you use the new ASP.NET Web Site project. This allows the compiler to dynamically compile all the support code into a single assembly while compiling each page into a separate assembly (or together, its an option) such that you can dynamically update your site without recompiling and deploying all the code. In v2 there are several deployment models so you need to decide which works best for you. Nevertheless you should keep the codebehind with the ASPX pages and all other support classes in the App_code directory. In fact VS will tell you that when you try to add a non-UI class to the project.

As for debugging you will enable the option in web config (or start debugging and VS will prompt you to make the change automatically). In VS 2005 you will normally debug and test against the web server provided by VS so there is no remote debugging (or admin rights needed). If you want to debug and test against a separate machine or IIS then you'll need to be an admin and have sufficient rights on the machine. You'll also need to ensure that Windows Identity is enabled in IIS otherwise debugging will not work properly. Assuming your system is not locked down to much it should work. There are a variety of documents on MSDN on how to get a remote web server set up for debugging. Ultimately though it is quicker and easier to debug and test against the VS web server first and then deploy to a central web server for QA and release.

Michael Taylor - 1/31/07