Microsoft KB Archive/167453

From BetaArchive Wiki
Knowledge Base


How To Associate File Extensions with Visual InterDev Editors

Article ID: 167453

Article Last Modified on 5/2/2006



APPLIES TO

  • Microsoft Visual InterDev 1.0 Standard Edition
  • Microsoft Visual InterDev 6.0 Standard Edition



This article was previously published under Q167453

SUMMARY

This article describes how to associate a file extension in Visual InterDev with Source Editor. For example, when you associate the .shtml file extension with Source Editor, you can double-click an .shtml file and have it displayed with the proper color coding.

IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry


MORE INFORMATION

The example below associates the .shtml file extension with a source editor. Before you perform the steps below, make sure Visual InterDev is closed.

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

Use the following steps to associate a file extension with a file type (this causes the correct icon to appear next to the file in the project):

  1. On the Start menu, click Run. Type regedit in the text box, and click OK.
  2. Right-click HKEY_CLASSES_ROOT, select New, and click Key.
  3. Name the key .shtml.
  4. Right-click .shtml, select New, and click String Value.
  5. Name the string value Content Type.
  6. Double-click Default and set the Value data to htmlfile.
  7. Double-click Content Type and set the Value data to text/html.

Use the following steps to associate the .shtml file extension with Source Editor in Visual InterDev 1.0:

  1. In RegEdit, locate the following key:

    HKEY_CURRENT_USER\Software\Microsoft\DevStudio\5.0\ IStudioProject\Editors

  2. Right-click Editors, select New, and click Key.
  3. Name the key .shtml.
  4. Right-click .shtml, select New, and click String Value.
  5. Name the string value :Source Editor.
  6. Double-click Default and set the Value data to :Source Editor.

NOTE: At the same level in the registry editor as "...\Editors\.shtml," you should see a key named ":Source Editor." If you do not see this key, this example will not work. Source Editor is the editor integrated into Visual InterDev and requires a reinstall of Visual InterDev if it is not registered properly.

Use the following steps to associate the .shtml file extension with Source Editor in Visual Interdev 6.0:

  1. In the Project Explorer of Visual InterDev, select the file.
  2. Right-click the file, and select Open With.
  3. Select the editor that you would like to use. In this case, select the Html Editor.
  4. Click Set As Default.
  5. Click Open to open the file with that editor.

Use the following steps to associate the .shtml file extension with HTML (this tells Visual InterDev to treat the file as an HTML file, thereby enabling color coding):

  1. If you are using Visual InterDev 6.0: In RegEdit, locate the following key:

    HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Text Editor\Tabs\Language Settings\HTML

    -OR-

    If you are using Visual InterDev 1.0:

    In RegEdit, locate the following key:

    HKEY_CURRENT_USER\Software\Microsoft\DevStudio\5.0\Text Editor\Tabs\Language Settings\HTML

  2. Double-click FileExtensions and add ;shtml to the end of the string.
  3. Close the registry and restart the computer.

NOTE: To display JavaScript or VBScript with color coding, you must enclose JavaScript or VBScript in SCRIPT tags. If you cannot enclose your code in SCRIPT tags (as is the case when you use a .js or .vbs file), you can use the following workaround.

This workaround involves commenting the SCRIPT tags for a .js file:

//<SCRIPT LANGUAGE="JavaScript">
function helloWorld ()
{
alert ("Hello World ");
}
//</SCRIPT>
                

This workaround involves commenting the SCRIPT tags for a .vbs file:

 
'<SCRIPT LANGUAGE="VBScript">
function helloWorld ()
  MsgBox("Hello World")
End Function 
'</SCRIPT>
                

REFERENCES

For the latest Knowledge Base articles and other support information on Visual InterDev and Active Server Pages, see the following Microsoft Technical Support Web site:

Keywords: kbhowto kbide KB167453