Assign .vcproj files to Visual Studio 2008, when Visual Studio 2010 installed - windows

I have encountered a strange error. I use Windows 7 x64. Visual Studio 2010 (VS10) and Visual Studio 2008 (VS08) are both installed. Now i want to make sure that when i doubleclick open a .vcproj file it is being opened by VS8 and not VS10. Now this seems like a trivial problem, but:
"righclick -> open with -> choose default program -> select devenv.exe of VS08 -> always open with" doesnt work. In fact after browsing for devenv.exe of VS08 it does not show up in the list/menue where it is supposed to be displayed.
This is very strange and annoying, maybe someone already encountered this error and know a solution.

I GOT IT! For the Express versions at least. I strongly suspect these instructions can be modified to apply to the full version. The names will change of course.
I spent a lot more time on this than I will ever save by being able to click through to the correct IDE, but darn it, I just hate to give up.
Here's the deal. Strangely, the associations seem to be keyed to the program file names. (Say, what?? That sure is the way it looks to me.) Both VC++ Express 2008 and 2010 are named VCExpress.exe. We'll give the 2008 version an alias. We'll also use a doppelganger to pull off something of a ruse.
Navigate to "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE". Make a copy of VCExpress.exe, (not a shortcut), and re-name it VCExpress-2008.exe. (It would probably do just to re-name the original and use the new name in step 3.)
Open regedit.exe. Create a new key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\VSExpress-2008.exe
Edit the (default) value in that key, to hold the string "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe" [sic]
Go through the drill with the file-association dialog again. Right-click, open with, choose default program, yada, yada, yada. Browse your way down to C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE and click on VSExpress-2008.exe.
VCExpress-2008 now shows up as a program in good standing, with its icon proudly displayed on the front page above the fold. (Don't tell the dialog, but you and I know it really points to VCExpress.exe, not the copy we made.) Click it.
Celebrate.

Ok i finally found a way. You can use the application "default programs editor" to mess with the standard file associations.

Related

Visual Studio files association in Windows

In Windows Explorer when I double-click on any Visual Studio file (*.cs, *.csproj, etc.), it's opening an old version of VS instead of the latest one (VS 2017). And VS has associations with too many file types.
How can I change the default Visual Studio (for all those files that VS can handle)?
There is a similar old question about Visual Studio 2008 (Move file associations from Visual Studio 2005 to 2008) but the solution in there doesn't work anymore (there is no "Restore File Associations" button on the settings of Visual Studio 2017).
Each version of Visual Studio registers itself in the Set Default Programs panel of the Control Panel.
Go to Control Panel\Programs\Default Programs
Then choose Set Default Programs:
In there you can simply choose the Visual studio version of your choice and then click the button Set this program as default in order to associate every file type that VS handles.
Or you might prefer to click the button Choose defaults for this program to review the current associations of those file types and change only the ones you want.
Yet another in a long list of previously working-just-fine things which Microsoft have managed totally #$#%# up. If I try to change defaults the 'right' way I get this kind of thing:
i.e. completely ignored. The only way I've managed to solve it is by removing the file association entirely through the registry. Let's take .asm as an example:
Open Registry Editor / "regedit.exe"
Navigate to HKEY_CLASSES_ROOT\.asm\OpenWithProgIds
Delete any Visual Studio values you see
From there, you can (finally) open files with whatever you choose instead of having the association clamped to Visual Studio:
For the record, I believe this to be a problem with Windows 10. Not with Visual Studio. See: https://answers.microsoft.com/en-us/windows/forum/windows_10-files/cant-change-default-programs-in-windows-10/229fc3a9-25c9-433b-a333-5806bc5090db
On the file you will always open with vs17, click right and choose open with and there choose another app. On win10 it pop out a dialog with some proposals. If vs17 is there, choose your favorite and activate the always open with. then ok and your done.

vsix opens visual studio

I seem to have got my system into a bit of a pickle with respect to Visual Studio extensions.
Normally I would use Nuget.
When an extension is not on Nuget, I'd download the vsix file and double-click on it to start the installation process. But now, when I double-click on the vsix file, it opens it in the Visual Studio text editor, treating it as a file to be edited, rather than executing it as a file to be executed.
Anyone know how I can restore the correct, intended behaviour?
Thanks
First way: if you open regedit and see keys under HKEY_CURRENT_USER\Software\Classes.vsix, just delete that entire key. That should allow the global registrations in HKLM to take effect again.
Otherwise, right click on the file, Open With, and choose "C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe".

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 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.
FIle Type Settings > Context Menu
Search .php (or whatever association) - note you can multi-select
Click next
Click Add... under the list
Enter the following data:
Command name: Open
Program path: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" /dde
Now unfold the Advanced Settings, tick Use DDE Message, and click Edit. Add the following:
Message: Open("%1")
Application: VisualStudio.11.0
Topic: system
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.

Can't "go to declaration" in *.ashx files (Visual Studio 2008)

When I open *.ashx files in Visual Studio, I don't have the helpful "Go to Declaration" context menu when right-clicking on a function.
How can I restore this functionality (this is a new install)?
Thanks very much.
Click on the text you want to go to and key F12 if it's not showing up for you.
Much like Windows Operation Systems need to reboot when things start breaking down, Studio sometimes needs a restart if that doesn't work.
Obviously this doesn't get your menu item back, but it's a fix that you might prefer over selecting that from the right-click mouse menu.
This is a shot in the dark since I do not work with ASP-related stuff.
Short Answer
If your *.ashx files belong to a project, open the project first.
Longer Answer
Most of my work in Visual Studio 2008 is with C++ and C# code. If I open a .cpp file or .cs file in VS2008 independent of the project it belongs to, VS2008 doesn't give me the Go To Declaration context menu either. When I open files independent of the project they belong to, VS2008 (or any Visual Studio version for that matter) is little more than a glorified editor. To get the benefit of Go To Declaration and other features, e.g., Intellisense, I have to first open the project and then open the file from within VS2008.
Alternate Answer
If you are already doing this, you might try deleting the .suo file in your project directory and letting VS2008 re-create it.
Apology
Sorry if this was simply stating the obvious. I know I've been frustrated at times when I've opened a file outside the context of its project only to realize what I want to do requires me to open the project anyway. Someone new to Visual Studio might not realize the project is sometimes required.

How do I force Visual Studio 2008 to use an Open instance when double clicking a file?

Certain non-project files that I use Visual studio for (.build, .xml, free-roaming html and css files) are already associated with visual studio and open in it when i double click them.
How can I get them to open in an existing instance of visual studio? Right now If i double-click the same file twice, it will open two instances of visual studio, I'd like it just to basically ignore the second open attempt if there is already an instance of VS open.
Windows 7 vs2010 answer;
Because "Default Programs > Associate a file type or protocol with a program" is so useless, use regedit.
Navigate to HKEY_CLASSES_ROOT\VisualStudio.XXX.10.0\shell\Open\Command and add /edit to the end of the open with line, where XXX is the filetype you wish to affect.
Example .reg file for .cpp;
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\VisualStudio.cpp.10.0\shell\Open\Command]
#="\"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\devenv.exe\" /dde /edit"
Ok Richard helped point me in the right direction a bit, but I think I found exactly what I want.
from an explorer window, go to Tools->Folder Options->File Types tab
find the extension you wish to change.
If there is a restore button click it.
Click Advanced
Click New... to create a new action.
I set the following:
Action: Open in VS 2008
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" /dde
check use dde
DDE Message: Open("%1")
Application: VisualStudio.9.0
DDE Application Not Running: (left blank)
Topic: System
Hit Ok
Set the new action as the default.
Hit Ok, Hit Ok
Now that extension will behave exactly as described in the question. The file will open in an existing VS if visual studio is already open.
I also used this to fix a few extensions that got broken when I reinstalled VS 2005 after 2008.
Win 7/ VS 2012
You can right click a file, go to properties.
Then there is an "Opens With" line and a change button. But I don't see a way to force other command line options. VS2012 seems to use the open instance by default.
Which version of VS?
For 2003, there's VSEdit.
In 2005, well, that's the way it works for me out-of-the-box. A quick Google search found something that may help.
Hope that helps.
Later versions of Visual Studio also seem to have problems opening files via DDE from certain applications (e.g. in SSHCommunications' Secure File Transfer Client; Winzip and explorer seem to work fine). This still happens with the solutions given previously.
When IDE already loaded, the IDE focuses but gives error 'The template specified cannot be found. Please check that the full path is correct'
When IDE not loaded, it intermittently gives error 'The file cannot be opened because it is being used by another process. Please close all applications that might access this file and try again'. Trying again proceeds as 1)
You can get it working in all situations using a combination of all the previous posts!
Install the VSEdit application (as suggested by Richard/Jeff for .Net 2003), regardless of the version (or versions) of msdev that you use: the post by Sara Ford to which they refer recommends VSEdit for command line operation in VS2005 - it also seems to work for later versions.
Alter the DDE (Tools->Folder Options->File Types) as Jeff proposes but to open via VSEdit.exe instead of devenv.exe directly. Specifically:
Action: Open "C:\Program Files\PowerToys for Visual Studio .NET
2003\VSEdit\VSEdit.exe" /c "C:\Program Files\Microsoft Visual Studio
9.0\Common7\IDE\devenv.exe /Edit """%1"""" "%1" use dde: (checked) DDE Message: (left blank) Application: VSEdit DDE Application Not
Running: (left blank) Topic: System
N.B. The triple/quad quotation marks are deliberate - they add the first opened file (quoted) to the end of the launch command to prevent msdev complaining about the command line usage of the /Edit mode if launched. Obviously command paths will need changing for different installations.

Resources