when viewing details of a shelveset, when i double click the .cs or .sql files, why it opens in notepad? - visual-studio-2010

i have gone through the this post and it says that the files take the automatic behavior of the windows to open the .cs and .sql files.
in my case when i open these files from a folder it opens up correctly in vs and sql server for .cs and .sql respectively.
Can anyone tell me how to open a file in a shelve in any editor other than notepad?
i have also checked the file types tab in folder options.

I believe you are using the VS Shelveset Dialog which is modal - maybe that's the reason "they" designed the View function to spawn a new process of notepad. It's unfortunate because for some file types, the editor is not VS but it will still bring up notepad. This is consistent with all other TFS related operations in VS. with changesets, you can view files in VS or other editor, when you look at any non-modal dialog (history for a single file for example)
So unfortunately without hacking around there's no way to change this behavior.

Related

Creating .resx files with ReSharper

So quite often I will add a line to my code GetLocalResourceObject("Para1") and then press Alt-Enter to have ReSharper first create the .resx file (on the first go) and then again to have it generate the line.
My pet peeve: it always opens the .resx file in it's XML view, which sometimes is OK but a lot of the time I end up having to find the file and open it in the resource editor view. Is there a way to have ReSharper instead open the .resx file in the resource editor view by default?

.vbp could not be loaded and NOT in notepad neither

As of yesterday, my vbp file refuses to open '.vbp could not be loaded'. If i try to open the individual forms, some of them work (open in vb6), some of them produce error .log file with two class errors : Class TabDlg.SSTab of control mstTabArticles was not a loaded control class. Line 3672: Class MSComCtl2.DTPicker of control dtpTicketDate was not a loaded control class.
I cannot open the vbp in notepad neither (=empty) and in wordpad i only get small squares...
Any help please?
Your .vbp file is corrupt. You will either need to restore from your backup or source control (you do have both of those don't you?).
Failing that, you will need to recreate the project file from scratch and readd each of the forms. You'll need to figure out what controls and references were loaded though.
As for the errors when loading the form files, this is normal as the controls have not been added to the project.
One other possibility is to open your file with a hex editor. You may be able to rescue a good deal of the text from the corrupt file and copy it to a new one.

VS2010 - Open a solution, file in this sln will open too

i created a little application (win forms) thats create a solution, adds a project and some files to the project. By clicking a button, the new solution should open by the installed vs2010 express. Thats works fine, everything is ok. My question, is there a way to open a specific file in the solution when the hole solution was loaded? For a better understanding, the user (of my application) creates a sln with 3 files (a.cs, b.cs and c.cs). He selects b.cs (in my application), and opens the sln. In the editor in vs, the preselected b.cs should be open.
I've tried to create a sou - file, but i think thats not the right way...
Is there a way to do this?!
Thx and regards
Sascha
Visual Studio remembers the files you had open when you last closed the solution, along with other things like breakpoints, by using the SUO file. You can check this with a simple experiment: close your solution with just a single file opened inside it (a.cs, for example), manually delete the SUO file (don't worry, VS recreates it if it doesn't exists) and when you open the solution again you'll see you won't have any file opened, and you'd lost any breakpoints you had.
So the obvious thing to do here would be to manipulate the SUO, storing on it the file selected by the user and then opening VS from your tool. The only thing I've found on the documentation is the IVsPersistSolutionOpts but I don't have any direct experience with it.
Also check this CodeProject article: while its main focus is to add a Tool Window to Visual Studio, it also uses IVsPersistSolutionOpts.

How does one copy a dialog resource from one project to another in Visual Studio 6.0 or Embedded VC++ (eVC)?

I've got two branches of code. 1 has a dialog box that the other doesn't, but because of politics the dialog box wasn't moved into the newest branch. Now they want it in...
So is it possible to copy a dialog box from one project to another.
There apears to be an export and import feature however it's greyed out.
.RC files are simple text files. You can simply copy/paste the DIALOG text from one .RC file to the other. Make sure that you copy the corresponding RESOURCE.H entries as well.
Alternatively, you might be able to open both .RC files and then simply drag-and-drop the dialog from one to the other.
Update for Visual Studio 2010 - 2013:
You can still drag-drop and copy-paste, but only outside of your project / solution.
Close solution, open both RC as files without any open solution, and go. For drag, "Hold down the CTRL key and drag the resource to the second .rc file. For example, drag IDD_DIALOG1 from Source1.rc to Source2.rc."
Microsoft - How to Copy Resources
Drag and drop doesn't work in Visual Studio 2010. Editing the .RC file does work but be careful. For me the ID for the dialog showed up with *ID_etc*. I copied it and removed the *'s and it seemed to fix the problem.
I finally figure it out how to copy a Dialog from one solution to another.
Steps:
Open both solutions in separte windows.
Add a new Blank Dialog -Add Resources-> add->newDialog
Open Both Dialogs Open Binary data.
Copy the Binary data from source solution dialog to Destination Dialog
This is just to add some visual detail to the accepted answer (by Roger Lipscombe) along with its steps.
In order to copy a resource such as a Dialog from one project another project, below steps can be followed.
Start a new instance of Visual Studio.
Open both source and destination .RC file as files, as shown in the picture.
From the source RC file, copy required dialog.
Switch to the destination RC file tab and simply paste it.
Please note that this operation would have updated the resource.h file. That is an excellent help by Visual Studio.
One will have to make sure that no duplicate resource IDs are present in the resource.h file. When working with some legacy projects, it is found that there came some duplicate resource Ids that had to be manually corrected. It looks like such an effort is worth considering the mammoth task required otherwise.

Visual Studio open files question

Is it possible to open a project in Visual Studio 2008 without opening all the files that were previously opened last time I had the project open. I have a habit of keeping many files open as I am working on them, so next time I open the project, it (very slowly) loads up a bunch of files into the editor that I may not even need open. I have searched through the settings and cannot find anything to stop this behavior.
Simply delete the .suo file.
It contains the list of open files.
A bit of research turns up the fact that you can do it with a macro:
Create a new macro (or use an existing one). You should see a module called EnvironmentEvents in Macro Explorer. (For details, see here.)
Open the EnvironmentEvents module.
Put in this code:
Public Sub CloseDocsOnExit() Handles SolutionEvents.BeforeClosing
DTE.ExecuteCommand("Window.CloseAllDocuments")
End Sub
Save and Build the macro.
Open a whole bunch of documents in your solution, then close Visual Studio.
Yay! No more open documents!
(Note: Despite that it says SolutionEvents, it also works if you're working on a project that doesn't have a solution.)
I never realized how much that annoyed me as well! I haven't been able to find a setting, but in Options > Environment > Keyboard you can bind a shortcut to Window.CloseAllDocuments. ALT+X was unbound for me so I just used that. I'm interested if there's some hidden setting to automatically do this on solution exit though (or load).
Edit: Totally read the question wrong at first - ignore my first (now gone) answer. :)
I changed the keyboard mapping for CTRL-SHIFT-C from bringing up the Class View to closing all document windows - something I use several orders of magnitude more often - and then I just clear my workspace before closing a solution.
Try the following:
Close the program after closing all files.
Make a copy of [whatever].suo
Open the solution again, open some files, and exit.
Copy (don't move) the old .suo file over the one that was just generated.
Make the .suo file read only.
If you have a repository you might want to check that file in.
I suggest this because I was having the reverse problem, where it wasn't opening my old files automatically, and the cause was a .suo file that had been checked into the repository and was (for some reason) not being overwritten by Studio. The file wasn't even write protected.
I was hoping for something a little more automatic. VS will create a new .suo file every time the project is saved. So I would have to delete that file every time I open the project. I also don't want to have to remember to close all the files before closing VS.
Other IDEs that I have used have similar functionality, but also make it rather simple to turn on/off.
Thanks for your help.
Or you can close all open document from the Window menu before closing VS.
In Visual Studio 6.0 (VC++), the procedure is slightly different.
Delete the .ncb file (located normally in the same place as your .dsp or .dsw files).
The only way works for me is : change the project location and again reopen the solutions form there. :)

Resources