开发者

How to add a new file association to Visual Studio?

(Windows XP, Visual Studio 2010 Express (Web Developer))

I would like to add various file types to open in Visual Studio that it does not open by default, namely .js, .html, .shtml, .css, etc.

I tried looking for UI inside Visual Studio to add new file types, but I couldn't find anything, so I tried the naive approach of right clicking on the file -> Open With -> Choose Program -> Browse -> c:\program files\Microsoft Visual Studio 10.0\Common7\IDE\VWDExpress.exe. This almost works, except it starts a new instance of the IDE rather than opening a new tab the way .cs files do.

I've tried to go registry diving, exported the association for .cs files, and changing it to point to .shtml (for example), but this still spawns new windows.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.shtml]
"Content Type"="text/plain"
"PerceivedType"="text"
@="VWDExpress.cs.10.0"

[HKEY_CLASSES_ROOT\.shtml\OpenWithProgids]
"VSTA.cs.9.0"=""
"VWDExpress.cs.9.0"=""
"VWDExpress.cs.10.0"=""

[HKEY_CLASSES_ROOT\.shtml\OpenWithProgids\Shared]
@="Shared key to keep this from being removed with install/uninstall of side-by-side components."

[HKEY_CLASSES_ROOT\.shtml\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

I strongly suspect that doing this is the开发者_JAVA百科 wrong way to go about this, but I can't find a better solution. Is there one?


Ive had the same issue so downloaded VWD with SP1 along with VS.PHP 2.10. Right clicked on a .php file and chose 'open with vs.php 2.10', checked the checkbox on bottom which saves settings. Double clicking on a php file has been working since then. In order to be able to use it from a file manager like winscp i had to put 'explorer' as the editor executable. It works for my js html css and php files and opens them in the same VWD instance. Only pain may be that vs.php is to be paid for eventually and that you'd need to associate every extension you wish to work with.


After you use naive approach to associate file with VWDExpress.exe, find a command in registry and add /EDIT parameter. I don't know if this works for Express versions, but for full Visual Studio this opens file in already open Visual Studio instance.


Download Default Programs Editor and open.

In my case I was associating .php files to Visual Studio 11, and to do this I simply copied the settings for .cs files. I've noted all steps below.

  1. FIle Type Settings > Context Menu
  2. Search .php (or whatever association) - note you can multi-select
  3. Click next
  4. Click Add... under the list
  5. Enter the following data:

Command name: Open

Program path: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" /dde

How to add a new file association to Visual Studio?

Now unfold the Advanced Settings, tick Use DDE Message, and click Edit. Add the following:

Message: Open("%1")

Application: VisualStudio.11.0

Topic: system

How to add a new file association to Visual Studio?

If you want to apply this to lots of files I suggest using the built in saving to registry option and creating a batch script with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜