Opening a CSS file in Visual Studio 2010 may throw error ‘The operation could not be completed. Unspecified error.’

ISSUE DESCRIPTION:

Trying to open a CSS file in Visual Studio 2010 shows error ‘The operation could not be completed. Unspecified error.’

WHAT IS CSS?

A cascading style sheet (CSS) contains style rules that are applied to elements in a Web page. CSS styles define how elements are displayed and where they are positioned on the page. Instead of assigning attributes to each element on your page individually, you can create a general rule that applies attributes whenever a Web browser encounters an instance of an element or an element that is assigned to a certain style class.

ENVIRONMENT:

All OS versions supporting VS2010

SYMPTOM AND INFERENCE:

Trying to open a CSS file from an existing project may can throw up the below error.

clip_image001

What might add to the confusion is that the same instance of Visual Studio 2010 may be able to open certain CSS files, and show the above error for others!

The underlying cause is that while you may have installed the service pack, and installed all the required updates, Visual Studio still does not support CSS above version 2.1. This is evident from the below dropdown-

clip_image002

RESOLUTION:

The resolution is to add the supportability for CSS version 3 as below-

1. Launch Visual Studio 2010

2. Click on ‘Tools’

3. Click on ‘Extension Manager…

4. Under ‘Online Gallery’ search for

"Web Standards Update for Microsoft Visual Studio 2010 sp1"

clip_image004

5. Download the update

6. Exit from Visual Studio 2010

7. Re-launch Visual Studio 2010

Further once this is done you can also notice the addition of the next version in the dropdown as illustrated below-

image

MORE ON CSS3!

Content By: Ritwik Sinha