Welcome to MSDN Blogs Sign in | Join | Help

Visual Web Developer Team Blog

Your official information source from the Visual Web Developer team.

News

  • These postings are provided "AS IS" with no warranties, and confer no rights. Use of included code samples are subject to the terms specified Terms of Use
Spell checker update 2.2: full support for VS 2008 SP1, simpler setup and a few bug fixes

Download: VSSpellChecker.msi

What's new in version 2.2:

  • Spell checker now fully supports VS 2008 SP1
  • Content of <code>, <abbr> and <address> elements is ignored
  • Setup no longer requires COM registration, it uses VS AddIn registration in XML file
  • List of words to ignore (SpellChecker.ignore file) was moved from AppData to AddIns folder
  • Fixed bugs:
    • Add To Dictionary may corrupt Word custom dictionary file dictionary file was not in Unicode
    • Windows update to MSXML may cause "Ignore" and "Add To Dictionary" command to disappear
    • After word was added to dictionary it may continue to be flagged as an error until VS is restarted


Note: There is no v2.2 for VS 2005 or VS 2008 RTM. From now on updates will be provided for VS 2008 SP1 only. Version 2.1 will remain available for VS 2008 RTM and VS 2005 SP1.

Spell checker supports text verification in:

  • HTML style comments <-- HTML -->
  • ASP.NET server side comments: <%-- ASP.NET --%>
  • JScript, C# and C++ comments: // C++ style comments
  • CSS and C style comments: /* C style comments */
  • VB and VBScript style comments: 'This is VB comment

Spell checking is supported in style and script blocks as well as in JS, CS, VB, CSS, CPP and H files

Requirements:

Microsoft Visual Studio 2008 SP1, any edition except Express.
Microsoft Word 2003 or 2007

Installation

  • Close Visual Studio
  • Uninstall previous version
  • Download and run VSSpellChecker.msi
  • Run Visual Studio
  • Open a Web site or standalone HTML file.
  • You should see Spell Checker entry in the Tools menu.

 

The add-in is now installed in your user folder under Documents\Visual Studio 2008\Add-Ins. More details on VS AddIn XML registration can be found here. Spell checking engine remains native C++ dll, but I added a managed wrapper which can be registered using simple XML file and hence COM registration is no longer needed. This should solve issues with setup under Vista and UAC.

Uninstall
  • Close Visual Studio
  • Open Control Panel
  • Go to Add/Remove Programs
  • Locate Spell Checker Add-in for Visual Studio 2008 and click Remove

How to use the Spell Checker

Important note: Add-in does not work with Visual Web Developer Express as Express editions are not extensible.

Open a Web Form, HTML, ASP, JS, VBS, CS, VB, CPP or CSS file and click Tools | Spell Checker. Spell check may take 10-15 seconds on decently sized files. There is no immediate progress indication, but you can see that squiggles appear one by one under misspelled words. Double click on the misspelled word brings list of suggestions. <Cancel> closes the suggestion list. Spell checker messages also show up in the Error List as informational messages. They are not entered as errors or warnings so they don't break builds.

Switching off spelling errors:


Ignore command

Ignore command adds word to SpellChecker.ignore file. The file it located in Documents\Visual Studio 2008\AddIns\Spell Checker. It is an Unicode text file.

Add to Dictionary command

Add to Dictionary command modifies Microsoft Office custom dictionary file. Typically it is an Unicode text file that is stored in the roaming profile in the Microsoft\UProof folder

Microsoft Office custom dictionary location

You can edit list of words in the Office custom dictionary using Microsoft Word facilities:

Microsoft Word menu

Microsoft Word proofing options Microsoft Word custom dictionary editor

Since using custom dictionary and ignore list introduces certain perfomance hit (which depends on the dictionary size), you can turn it off in rules.xml file located in the Spell Checker installation folder and change useOfficeCustomDictionary and/or useIgnoreList to 0.

<options>
    <
useOfficeCustomDictionary>0</useOfficeCustomDictionary>
    <
useIgnoreList>0</useIgnoreList>
</
options>

Multilanguage spell checking

Spell checker is able to detects lang attribute specified on elements, extract ISO language and use it to specify appropriate dictionary for the Office spell checking engine.

In order to be able to spell check pages in multiple languages you may need to install Microsoft Office 2003 Proofing Tools or an appropriate Office 2007 Language Pack. If you never used particular language dictionary in Word, you have to try using it at least once before it becomes available in the Spell Checker add-in. Many dictionaries are installed on demand and if particular language was never activated in Word, the dictionary may be missing. Open Word, type something in the desired language and run Word spell checker at least once to make sure it works and dictionary is installed: 

If you want to spell check multiple pages at one, look at this post:  Running Spell checker on all files in the solution 

Limitations:


Spell checker only works in Source view.
  1. Current version does not merge words split by tags, such as <b>S</b>ymbol. I am planning to add this functionality in a future version.
  2. Right click on the misspelled word does not bring suggestions, double-click does.

Customization

You can customize spell checker behavior by editing rules.xml file located in Program Files\HTML Spell Checker Add-In. You can exclude certain elements and add more rules for attribute checking if you want spell checker to verify spelling in custom control attributes. All element and attribute names much be in lowercase. You don't have to close document or Visual Studio after editing the file, the file is loaded every time spell checking is performed.

<?xml version="1.0" encoding="utf-8"?>
<rules>
<!-- Exclude content of script and style elements from spell check -->
<exclude name="script" />
<exclude name="style" />

<!-- Check 'value' attribute on all elements without a namespace -->
<element name="*">
<attribute name="value" />
</element>

<!-- Rules in ASP namespace -->
<namespace name="asp">

<!-- Check all attributes ending in 'text' as well as tooltip attribute in all ASP.NET elements -->
<element name="*">
<attribute name="*text" />
<attribute name="tooltip" />
</element>

<!-- Special rule for asp:Calendar -->
<element name="calendar">
<attribute name="caption" />
</element>

<!-- Add more rules for ASP.NET elements here if needed -->
</namespace>

<!-- Add rules for custom controls here if needed -->

</rules>
Posted: Saturday, November 29, 2008 2:33 AM by WebDevTools

Comments

Steven the .NET Junkie said:

Thanks for the tool! I have a problem though. While I often use the Word (2003) spell check to check English, the VSSpellCheck tool doesn't recognize English words, only Dutch (Dutch is the OS and Word language).

How can I make sure VSSpellCheck also checks English text?

# December 1, 2008 10:01 AM

WebDevTools said:

Steven, spell checker uses default Word dictionary. Perhaps Word is set up for Dutch only. There should be a way to specify additional languages. In O2007 there is a separate app http://blogs.msdn.com/mikhailarkhipov/archive/2007/12/18/how-to-select-language-for-spell-checking-in-code-comments.aspx. In O2003, I think the setting is somewhere in Tools | Spelling/Grammar...

# December 1, 2008 11:34 AM

Aaron said:

Thanks for the tool, I've just installed it into my computer and it works well. I guess I'll need it very soon :)

# December 1, 2008 11:55 AM

Stefan Olson said:

Is there any way to plug the spell-checking into the design view?  The design view should support on the fly spell-checking because it is available in expression web, which I understand uses the same technology.

# December 2, 2008 11:54 PM

Eric said:

Thanks for the update!  I uninstalled the previous and installed the new version, now I have two "Spell Check" menu items in my Tools menu.  Of course when I clicked the Bad one it recognized that it's add-in was no longer there and offered to remove the menu item, but I just wanted to post and let you know that the uninstallation of the previous version did not remove the menu item from Tools.

Again, thanks!

# December 3, 2008 10:01 AM

WebDevTools said:

Old version used COM registration and unfortunately during uninstall sometime old registry keys didn't get removed.

# December 5, 2008 6:40 PM

WebDevTools said:

Stefan, designer is indeed the same as in xWeb, but Expression Web is an Office product so it is using Office spell checker engine directly, same way other Office apps do. Visual Studio is not Office product so there are licensing limitations. Office spell checker and dicitonaries are not always Microsoft products (you can see it in Office Help | About information). This add-in uses separately installed Word via public interfaces which is different from direct usage of Office engine.

# December 5, 2008 6:49 PM

Stefan Olson said:

Fair enough.  Is there a way that I can plug my own spellchecker into the WYSIWYG designer?

# December 6, 2008 1:49 PM

Mostafa said:

Hi,

The spell checker is not working for me,i'm running vs 2008 SP1 with Vista SP1 on 64bit laptop.

any ideas why it didn't work with me ?

# December 6, 2008 4:45 PM

WebDevTools said:

Stefan: yes you can. Designer exposes DHTML model equivalent to IE4 (IHtmlDocument2) which you can obtain from VS extensibility interfaces:

http://msdn.microsoft.com/en-us/library/aa301592(VS.71).aspx

http://msdn.microsoft.com/en-us/library/aa301471(VS.71).aspx

Basically you get current tab object and then QI (C++) or cast (VB/C#) it for IHtmlDocument2

http://msdn.microsoft.com/en-us/library/aa752574.aspx

You can then walk designer element tree, extract text from elements and attributes and use Word spell checker

http://blogs.msdn.com/mikhailarkhipov/archive/2006/04/17/577852.aspx

# December 12, 2008 10:49 AM

Mikhail Arkhipov (MSFT)'s WebLog said:

I have been posting in our team blog primarily. Maybe I should have cross posted, but I didn't. I will

# December 18, 2008 1:30 PM

Mikhail Arkhipov (MSFT)'s WebLog said:

Some folks asked why VS 2008 and VWD Express 2008 do not have "live" spell checking like Expression Web

# December 18, 2008 2:30 PM

Paul Mooney said:

Spell checker update 2.2: full support for VS 2008 SP1, simpler setup and a few bug fixes Spell checker...

# December 18, 2008 3:08 PM

PWills said:

Any idea what's going wrong? After installation, I get the following error when loading Visual Studio:

OS: Vista Ultimate SP1 64-bit (6.0.6001)

VS: Professional 2008 SP1 (9.0.30729.1)

.NET: 3.5 SP1

"The Add-in 'Spell Checker' failed to load or caused an exception. Would you like to remove this Add-in? If you choose yes, the file it was loaded from, '...', will be renamed.

Error Message: <Unknown Error>

Error number: 8013150a"

# December 20, 2008 7:50 AM

Timwei Blog said:

以前我们在Visual Studio如果要执行拼写检查都会把文本复制到Word里去做,费时费事。 现在Visual Studi ...

# December 21, 2008 11:31 AM

David Hearn said:

To run the spell checker on all files in the solution, you must update the VB macro in the linked post to use 'DTE.ExecuteCommand("VSSpellCheckerAddIn.Connect.VSSpellCheckerAddIn")' instead of the old HTML command name.

# December 29, 2008 2:14 PM

Around and About .NET World said:

Nuova versione del correttore ortografico per Visual Studio 2008

# January 4, 2009 5:21 AM

Around and About .NET World said:

Da qualche giorno è stata rilasciata la versione 2.2 dello Spell checker per Visual Studio 2008, destinata

# January 4, 2009 6:09 AM

mostafa arafa said:

The posted version is not working if you didn't install SP1 for VS 2008,once i installed SP1 for VS 2008 the spell checker v2.2 is working fine to me.

Thanks.

# January 7, 2009 3:39 PM

WebDevTools said:

Correct, this version requires SP1.

# January 7, 2009 7:31 PM

John Fly said:

Given code to check the entire solution failed for me.. I ended up modifying to this :

Imports System

Imports EnvDTE

Imports EnvDTE80

Imports EnvDTE90

Imports System.Diagnostics

Public Module SpellCheck2

   Private _outputWindow As OutputWindowPane

   Public Sub SpellCheckSolution()

       _outputWindow = GetOutputWindowPane("Spell Checker")

       _outputWindow.Clear()

       _outputWindow.OutputString("Running spell check on files in the solution..." + vbCrLf)

       For Each project As Project In DTE.ActiveSolutionProjects

           ProcessProjectItemCollection(project.ProjectItems)

       Next

       _outputWindow.OutputString("Spell check complete." + vbCrLf)

   End Sub

   Private Sub ProcessProjectItemCollection(ByVal projItemsCollection As ProjectItems)

       Try

           For Each pi As ProjectItem In projItemsCollection

               If (pi.Name.EndsWith("aspx") Or pi.Name.EndsWith("ascx") Or pi.Name.EndsWith("html") Or pi.Name.EndsWith("htm")) Then

                   Dim window As Window = pi.Open(Constants.vsViewKindTextView)

                   window.Visible = True

                   window.Activate()

                   _outputWindow.OutputString("Checking : " + pi.Name + vbCrLf)

                   DTE.ExecuteCommand("VSSpellCheckerAddIn.Connect.VSSpellCheckerAddIn")

               Else

                   If pi.Kind = Constants.vsProjectItemKindPhysicalFolder Then

                       _outputWindow.OutputString("Container : " + pi.Name + vbCrLf)

                       ProcessProjectItemCollection(pi.ProjectItems)

                   Else

                       _outputWindow.OutputString("Not Checking :" + pi.Name + vbCrLf)

               End If '' end folder check

                   End If ''end  file extension check

           Next ''Get next project Item

       Catch e As System.Exception

           _outputWindow.OutputString(e.Message + vbCrLf)

       End Try

   End Sub

   Private Function GetOutputWindowPane(ByVal Name As String) As OutputWindowPane

       Dim window As Window

       Dim outputWindow As OutputWindow

       Dim outputWindowPane As OutputWindowPane

       window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)

       window.Visible = True

       outputWindow = window.Object

       Try

           outputWindowPane = outputWindow.OutputWindowPanes.Item(Name)

       Catch e As System.Exception

           outputWindowPane = outputWindow.OutputWindowPanes.Add(Name)

       End Try

       outputWindowPane.Activate()

       Return outputWindowPane

   End Function

End Module

# January 8, 2009 11:24 AM

Dicky said:

Thanks for the spell checker tool. I have been looking for one for so long.  I wish that the next VS would include this spell checker.

# February 9, 2009 2:07 PM

Wendell Kenney said:

I have installed version 2.2 as we are using VS 2008 SP1 and I get the spell checker in the menu and it acts like it is checking the first time I click on it but it never finds mispelled words.  I am in source view.

# February 11, 2009 9:23 AM
New Comments to this post are disabled
Page view tracker