Session / working set in visual studio 2012 - visual-studio

Is there any way of saving a "session" / "working set" in visual studio. By session ( ex: session in Notepad++ ) I mean group a bunch of files that I'm viewing so I can save and re-open that same set of files. Similar concept exists in eclipse "working set" which applies to projects ofcourse.

The way I am able to create such a session is:
Enable launching debugger automatically for the .exe to be debugged using "Image File Execution Options" in registry (see http://msdn.microsoft.com/en-us/library/a329t4ed%28v=vs.100%29.aspx). The .exe may be any executable, e.g. notepad.exe, in case you are not interested in debugging.
Run the .exe.
In the "Visual Studio Just-In-Time Debugger" dialog that is displayed, select "New instance of Microsoft Visual Studio 20xx" and click Yes.
In the new instance, open the files as required and do 'Save All' to save the .sln file at desired location. Your session, including open files and breakpoints, will be saved along with the .sln in .suo file.

Related

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".

MS Visual Studio.net - saved source files missing after reboot

The other day I created a MS visual studio 2010 C# project and started coding. I saved the source frequently, but I did not select a destination to save to (just pressed ctrl+s and assumed the source was being saved). However I had to run and threw my laptop in my backpack on sleep. Unfortunately this laptop (acer aspire 5252 fyi) battery drains extremely quickly when on sleep, and eventually my computer shut off. Now I can't find my source files anywhere and I'm going crazy because I know I saved it and it's several days worth of work.
I tried doing a windows search but couldn't find the project files. I also did a little experiment - I created a new project and without saving the entire solution, I pressed ctrl+s on the source files. Save was successful, but I cannot even find the file that's open in the IDE. Even the "open containing folder option" is grayed out (see screen shot).
I really need these source files back. Obviously it's because I didn't save the solution that the source got wiped out, but where do the source files get saved temporarily before the solution is saved?
Thanks.
You are using Visual Studio's support for temporary projects. Nice feature for quicky test projects (and SO answers) but not a great way to ensure that your projects are still there after VS quits. Programming without source control is similarly inadvisable.
Tools + Options, Projects and Solutions, General. Ensure that the "Save new projects when created" option is ticked to minimize the odds that you'll forget to pick a solution folder. Triple-check that creating a new project now gives you a "Location" property in the dialog.
There is a default location for projects to be saved. That is probably where your files went.
In Visual Studio, on the menu, click Tools > Options > Projects and Solutions > General. There is a "Visual Studio projects location".
On my Windows 7 machine, the folder for Visual Studio 2010 is
C:\Users\<username>\Documents\Visual Studio 2010\Projects
Your unnamed project is probably saved with a default name like WebSite1.
If you would like to change that default location, here is some information on how to do that.
Visual Studio temporary projects are normally found in *C:\Users\"User Name"\AppData\Local\Temporary Projects* . It is a temporary folder that is deleted as soon as Visual Studio starts up.
How to save a Temporay Project from above link:
To save a temporary project
In Solution Explorer, choose the solution or project that you want to save.
On the menu bar, choose File, Save or Save As.
The Save Project dialog box opens.
In the , Name box, specify a name for the project.
In the Location box, specify where you want to save the project.
Select the Create directory for Solution check box.
Note: This check box is not available for Visual Basic web projects, Visual C# web projects, or other directory-based projects.
In the New Solution Name box, specify a name that differs from the project name.
Select the Add to Source Control check box if you want to add the solution to a version-control database or repository.
Choose the OK button.

Visual Studio 2010 - How to enable prompt to delete file from disk when removed from project?

In Visual Studio 2005, when you remove a file from a C++ project (by right-clicking in the Solution Explorer and selecting "Remove"), it asks you whether you just want to delete the reference, or also delete the file itself from disk.
In Visual Studio 2010, this prompt seems to have disappeared (or I have accidentally turned it off). This means that every time I delete a file in the Solution Explorer, I have to immediately hunt it down and delete it with Windows Explorer (otherwise I'll forget and it will stay around forever). How do I get the prompt back?
I found some documentation (http://msdn.microsoft.com/en-us/library/0ebzhwsk%28v=vs.100%29.aspx) explaining the difference between "Remove" and "Delete", and that "Delete" doesn't exist for C++ projects (but no reason is given). Maybe it's really just not possible? If so, what an annoying regression.
You get the remove or delete file dialog only if the selected file is stored in the project folder. If the file is stored outside of the project folder the file reference is removed without dialog.
This behaviour is still the same for e.g. VS2013. I created a user voice request to change this behaviour here. IMHO your file hierarchy should not make any difference.
You can vote for the change here:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/9146353-remove-delete-dialog-should-show-up-when-deleting
Assuming one is using Sourcegear Vault as the source control system, you can enable the prompt by going to Tools -> Options -> Source Control -> Integration Options -> and check on "Show warning before deleting items from source control"

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.

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