Critical Development

Language design, framework development, UI design, robotics and more.

Office 2007 SP1 Screws Up Visual Studio 2008 Web Projects?

Posted by Dan Vanderboom on December 12, 2007

Early this morning I installed the Windows automatic updates that were waiting for me.  A message informed me that updates would be made to Visual Web Developer as well as Expression Web, both of which are installed on my laptop.  After a reboot, some more updates, and a second reboot, I opened my Visual Studio solutions eager to be productive.

COMException

Oops.  That never looks good.  And my web application project was unavailable.  It was working before I installed Windows updates.  What could be wrong?  Why can’t I get a useful error message that at least gives a clue about what it was attempting when it hit this brick wall?  “A funny thing happened on my way to load your web project…”

Because I noticed the message about the Office service pack updating Visual Web Developer, and being that my web project was suddenly not working, my first instinct was to uninstall the service pack.  According to this article, however…

http://support.microsoft.com/kb/873125

… this isn’t supported.  Great.  Second instinct: uninstall Office 2007.  Damn.  That’s going to take a lot of time.

My boss suggested creating a fresh web site project and testing that.  Good idea.  I was able to successfully create a new web application, so the web developer component must not have gotten completely hosed.  I then started to copy all of the project files from my real web project into this new, experimental project folder.  This kind of operation can be a royal pain in the butt.  Visual Studio has had really poor support for including existing folders in a project, at least from what I’ve seen.  “Add existing” files works great, just how you’d expect, but try adding a folder of files once.  I dare you.  I get one of two behaviors.  One, it pulls the files from within that folder, and instead of creating a new folder in the project and placing the files nicely in there, it dumps those files into the root project folder.  Two, it ignores you completely and doesn’t copy squat.  The second strategy is the one it chose for me today.  It might have to do with the fact that I tried to “add existing” and chose both files and folders of files at the same time.  The files copied; the folders did not.

This is a good lesson of what not to do for those of you learning how to build user interfaces.  When I want to include a folder, I want that folder to be represented in the project, and I want it to recursively add all the files and subfolders, etc., in it as well.  Anything else seems ridiculous.

So the trick that I use is to open both project files in Notepad, source and destination; I copy the <ItemGroup> sections from one to the other; and when I save the changes and focus on Visual Studio app, I get prompted to reload the project.  I do this piece by piece, because I have several ItemGroup sections.  I’m hoping to find a group of files that causes Visual Studio to freak out.  But the files and folders get added and everything looks okay.  I add the last ItemGroup, this time of References, and compile.  The build succeeds.  How could this be?!  If I have the same collection of files in two projects, why is one unavailable and the other is working just fine?

It must be some kind of project property.  Looking through the .csproj file, I found a section at the end called <ProjectExtensions>.  Both files had one, but the settings are a little different.  As soon as I saved those changes and reloaded the project in Visual Studio, my new test web application project blew up with the COMException, and the project became unavailable in Solution Explorer.  Bingo!

This is what my new test project looked like before I messed it up by pasting over it:

Xml for new project

And here’s what my real (messed up) application’s ProjectExtensions looked like:

Xml original

The element of importance here is UseIIS.  In the working test project, it’s set to False, because by default a web application will use the internal Cassini web server.  But we had been publishing and testing against an IIS server.

Then I noticed that my User Account Control (UAC) for Windows Vista had turned itself back on.  This really annoyed me.  After trying to deal with it for a while, I finally turned the damn thing off.  I can’t stand being told that access is denied when trying to perform the simplest operations.  It seems that every time I take Windows updates, it turns this back on.  I really can’t stand this behavior.

When I once again disabled UAC, this whole problem went away.  It would seem that Visual Studio was running into some UAC restriction by being set up for IIS with this project setting, but instead of UAC popping up to tell me about it, or Visual Studio reporting sensibly what it was trying to accomplish, I get a very useless COMException and an unavailable web project.

Why would the server you connect to be a project setting to be checked into source control and shared with the rest of the team?  Seems that this should be a user setting, so that one developer can use Cassini, another IIS, etc.  Sharing a list of available test web servers would be nice, but that would make more sense to be independent of Visual Studio solutions.

After losing a couple hours trying to troubleshoot this problem, I was finally able to move on.  Key point to remember: Visual Studio 2008 isn’t yet completely Vista friendly.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: