VS2010 Intellisense on class files - visual-studio-2010

I have a Web Application Project that I'm working on.
My solution looks like this :
./MyProject/
./MyProject/dataobjects.cs <- no intellisense
./MyProject/sqlquerying.cs <- no intellisense
./MyProject/default.aspx <- intellisense works here
./MyProject/default.aspx.cs <- intellisense works here
./MyProject/mypage.aspx <- intellisense works here
./MyProject/mypage.aspx.cs <- intellisense works here
Visual Studio 2010 doesn't give me any intellisense options when I work on non-code-behind files like Business Logic Layers and Data Logic Layers . In VS2008, I placed these files in the App_Code folder and intellisense worked fine.
What can I do?
Is there a specific folder I need to put these files in to get intellisense?

Found it!
Visual Studio was setting my code files as 'Content' instead of 'Compile' for the build option.
Here's an excerpt from the same question on MSDN forums for anyone who's interested:
if you're having
the intellisense issue, another thing
to check is the "Build Action" for
your code file... just look at the
file's properties and make sure the
"Build Action" property is set to
"Compile".

You may have a "Website" rather than a "Web Application".
In a Website non-page code files need to be either in App_Code or (ideally) in a separate project that is referenced.

You should have intellisense, regardless of where you put your class files. Is this a new VS 2010 project converted from a VS 2008 website?
Try right-clicking the project, and selecting 'Convert to Web Application'.
In a web application, You should have the aspx files, designer files, and code behind files. I have experienced similar oddities when converting a VS 2008 website to VS 2010 web application.

Related

How do you change the default programming language visual studio 2013?

I installed Visual Studio 2013 again after I got a new PC, but now when I create a new file it creates it as an VB file instead of c#.
I changed the default programming language in web.config like shown here:
I tried reloading the project but it still does not work.
The web project is placed on a local ftp server.
When you make a new project, under Templates you should see a node for Visual Basic and one for Visual C# with the different types of projects listed under the language. I believe VS remembers which one you used last.
The menu that shows up when you right click on a folder > "Add" shows a list of the options available for that folder ex. if you are in App_code it shows "Class". It seems it doesn't change the first suggestion to C# class even tho you change the programming language. So to fix that you go into the same menu and pick "Add New item..." and select C# Class file ...close it. Now if you try and create a file again it still says "Class" in the Add menu, but when you select it now, it creates it as an C#.
Sovled the problem for me. Thanks to all of you leading me to the answer.

How to add action to Visual Studio Solution Explorer?

Please let me know how to add an action into the context-menu of "Solution Explorer" in Visual Studio?
I'd like to add my action into the context-menu of files listed in this explorer (see a screenshot for example), and then be able to launch my application (EXE file) that can get the filename (including its path) as an argument.
I currently use VS2008, however please let me know if that should be different with VS2010 and VS2012.
THANK YOU
Write your own visual studio Add-In take a look at that link this is good place to start. but its not easy...
You're going to have to write a Visual Studio Add-In.
Take a look at the code for the Xsd2Code addin on codeplex. Specifically the Connect class. This addin does something similar to what you want... it adds a context menu option that's available when you right-click on project items (in this case, only enabled for .xsd files).
Also, check out the Solution Explorer Context Menu sample within the Visual Studio 2005 Automation Samples download.

How to reload a property sheet in Visual Studio 2010

Is there a way to reload a property sheet that was edited outside of Visual Studio? Visual Studio doesn't detected automatically that the file was modified (like it does with project files). The only way I've found so far is to close and reopen the whole solution (but that's no good way).
Only a partial solution perhaps for your (and my) needs, but I've found it helpful to touch the .sln file. This causes Visual Studio to wig out and ask if you want to reload all the projects. Select "Yes" and then you'll notice the properties have refreshed. I make sure that my scripts which update property files also touch any related solution file(s).
Also see Is there any way to get Visual Studio to reload all projects when the .proj files have changed?

Can I create a website project type in VS2010

We're upgrading to VS2010 and when I look in my "new project" window I can only see web application, not website. Has this gone? Is there an alternative?
I need this project type because we need to be able to edit code files on the fly on the live server - or has this now become an option embedded somewhere in the application project.
Cheers.
Use File>New>New Web Site, and you can find the web site templates.
But it does look like a very bad idea to edit on the fly files on a live server... Unless your customers are very understanding.
I doubt this is the answer since I ran into a similar thing with Visual Studio 2008, but I thought maybe it's still a quirk in Visual Studio 2010. I posted this on the "Community Content" section in the MSDN pages.
Creating multi-project solutions
This workflow to create a multi-project solution seems simple (and is), but it is very confusing if doing it for the first time, because this workflow wasn't QA'ed very well for intuativeness.
File > New > Project > New Project
... both the menu option and the dialog are misleading.. they should both say Project/Solution.. just like the Open menu does
Expand "Other Project Types", choose "Visual Studio Solutions" > Blank Solution
Right click your solution in Solution Explorer > Add New Project >
... I chose Visual C# > Web > ASP.NET Web Application (for an example)
OH NO! The solution dissapeared!
No problem, go to Tools (menu) > Options > Projects and Solutions > choose "Always show solution"
... sadly, this is unchecked by default for Visual Studio 2008

Visual Studio Intellisense works in Class Library but not Web Project files

I'm not sure how this happened as up until this morning my Intellisense was working fine in Visual Studio.
Now, however, I have lost Intellisense in my web project's files. Also, I don't see the little toolbar at the top of the window that allows me to select objects and controls
i.e. This one:
I did notice however that Intellisense and the controls selection toolbar works in my class library.
Any idea how to fix this?
I've read somewhere about setting the Build Action of my web project files to "Compile", but I cannot find a BuildAction property anywhere.
Right click on your web project, Select "Property Pages"(Shift+F4) and Click on "Build" You will see a check box "Build Web site as part of the solution". Make sure that is checked. I would also check if there are any projects that are not loaded in your solution and also restart VS and try loading the solution once again. See if you still face this issue.

Resources