views:

57

answers:

3

I have a solution, which I was working on yesterday without issue. Today I have opened the same solution and VS 2008 has underlined certain using directives in red. Mousing over the underlined directives brings up the tooltip: "Am I missing an assembly reference?" I am not, as I tried to add the references in and it does nothing to solve the problem.

Weirder still the project compiles and runs without a problem so it's only VS2008 that's having a problem with the project. I'd like to get all my objects back to a state where Intellisense recognises them, trying to maintain the code when VS doesn't recognise objects like DataTable, RegEx and TableCell is very frustrating.

The using directives at the head of my page are as follows, the bold ones are no longer recognised after the System namespace reference, the others work fine:

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

I don't really understand what's changed overnight to break the project. Any suggestions?

A: 

One thing that immediately jumps out is that all of the using directives that are not working come from assemblies other than the core .NET assembly. I would double-check that the references to these assemblies are still valid within your project file.

Ryan Brunner
Nice theory, but System.Text is in mscorlib.dll as well.
Hans Passant
Ah, right you are.
Ryan Brunner
+2  A: 

Some things you could try:

  • Delete the .suo and .csproj.user files in the solution and project directories, respectively. (The .suo file has the hidden attribute set.)
  • Create a new, blank project which doesn’t exhibit the problem you are experiencing, and then compare (using a file-compare tool) the new .csproj file with the .csproj that exhibits the problem. Remove things that appear to be redundant.
Timwi
+1, my money is on .suo as well.
Hans Passant
A: 

As some comments under my question recommended (and completely against the instincts of common sense) cleaning the project, rebuilding it and then restarting VS2008 did the job... Who can say why?

The only difference in my PCs start up this morning was that the company approved security solution McAfee System Hog (or whatever it's called) decided to soak up most of my system's resources downloading and installing some sort of update. During this period my PC was super slow to respond to anything I told it to do. Maybe the McAfee install interfered with the usual VS startup sequence.

Anyway, works now but I shall bear in mind other suggested solutions in case it ever happens again. Thanks!

bert