Visual Studio View Code on Multiple Files at Once - visual-studio

I'm in the process of migrating some Web Sites to Web Applications, using Visual Studio 2017. One thing I can't seem to figure out is how do I open multiple .cs files at the same time? I can open the .aspx file for them easy enough by right clicking and choosing Open. I can view the code behind on a single page at a time by right clicking and choosing View Code. In the old Web Sites I could right click multiple files at once and select View Code, however, it appears in Web Applications that option has been replaced with "View Code Gen File" which isn't the same thing. It's painfully slow to open a single page at a time so hopefully there is a setting I am just not finding.
EDIT: As requested, uploading screenshots. Only .aspx files are selected but when more than one is selected the "View Source" option is no longer there. Also I should note that if multiple are selected in Solution Explorer, pressing F7 also has no effect, though that keystroke does work to View Source of a single file at a time.

After further experimentation, I now see what you see and I agree that it's something that Microsoft broke along the way. In fact, in your own image, if you single-select an aspx file in Solution Explorer then you can see the "<>" icon appear in the button bar at the top of Solution Explorer. But that icon disappears whenever you select two or more aspx files.
I've done a lot of work with Visual Studio over the years and I can't imagine any justifiable reason why Microsoft would have deliberately removed the View Code option from the context menu for multiply selected aspx files.
This appears to be a bona fide bug that should be reported to Microsoft.
Meanwhile, as a workaround, use the File | Open option in Visual Studio 2017 and, in the resulting Open File dialog box, simply multi-select any .cs files you need (this dialog box allows you to multi-select files and open all of them at once).

Related

How do I open a Visual Studio project in design view?

I saved my project, but now I can't open it up in design view where you see all the buttons and stuff. Visual Studio 2012
Anyone know how?
You can double click directly on the .cs file representing your form in the Solution Explorer :
This will open Form1.cs [Design], which contains the drag&drop controls.
If you are directly in the code behind (The file named Form1.cs, without "[Design]"), you can press Shift + F7 (or only F7 depending on the project type) instead to open it.
From the design view, you can switch back to the Code Behind by pressing F7.
My problem, it showed an error called "The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again. ". So I moved the Form class to the first one and it worked. :)
From the Solution Explorer window select your form, right-click, click on View Designer. Voila! The form should display.
Click on the form in the Solution Explorer
Just Shift+f7 and Design view will open
OR
Right-click on your form file and Click on View Designer
I had this problem in Visual Studio 2019 today. When I right-clicked a form or user control in Solution Explorer, there was no "View Designer Shift-F7" option. The "View Code F7" option was there, but not the Shift-F7 option. I noticed that I could view and work on the design view for two forms, that I opened before the problem surfaced. But Visual Studio would not let me open more design views.
My solution is: In another project, in the same solution, I created a new Windows Form. Now the "View Designer Shift-F7" is visible and working for all forms and user controls, in all projects in my solution. I deleted the latest new form, and Design View still works. This solved the problem for me.
#Pierre's answer is not always applicable. When I messed up the files in the solution folder a bit (maybe add some code from outside which conflicts the GUI, I don't know precisely), then the Design View does not show up. In fact, my "Solution Explorer" is actually "Solution Explorer - Folder View". There is no object hierachy shown in the Solution Explorer, but just a file & folder view.

Visual Studio 2012 Highlight all open files in solution explorer?

Question:
Is there a way to make all files that are open in visual studio be highlighted in the solution explorer?
(I know there is a filter that you can filter it to show only open files but this dos me no good sense I am looking for a file that may not be open, I am not even sure what the name of the file is until I open it up and say there it is.)
Example Imagined GUI result: (Different colors are fine)
https://docs.google.com/file/d/0B31DHM9TkK99S3pWSms3QXR2Qk0/edit?usp=sharing
(image of what i am thinking, can not post image right now)
Solution Explorer
-Solution
+Stuff
+More stuff
-Code
+MyOpenFile.cs (Highlighting)
+MyNotOpenFile.cs
+MyOtherOpenFile.cs (Highlighting)
+MyCurrentlyOpenFile.cs (Highlighting, maybe a different color)
(the one with the red under line could be the active tab)
Background:
I don't know if this happens to any one else, but I have been doing it a lot for years now. While working on something I go to open up a file in the solution explorer and it turns out that the file is already open, and so visual studios just sets that file as the active tab. If I were working In just one window that would be fine, but I have few tab windows open beyond the main window and they are normally on a diffident monitor, so when the tab becomes active I do not see it at all, because it is not on the main window. This is even worse when I go to preview a file.
Icing on this cake:
-If it would have an option to highlight the parent nodes of open files, i the example "controllers" and "content" folders would be highlighted as well.
-If there was something that would do this for vs 2010 as well would be great.
I am looking for all most any thing at this point, an extension, a style sheet some where to edit, or as a last resort a good reference to a "How to code Extensions for Visual studios" website.
Edit:
As a point Of clarification I am not looking for a way to locate a specific file in the solution explorer, I am looking for a way to make the files that are open look visually different, so that I know to look around a bit before thinking that VS2012 is crashing or the file is messed up.
try an extension called VS commands. It will help you locate the files in solution.
Or this extension:
http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/

Customizing toolbar items in VS2010

Has the menu & toolbar customization functionality in VS2010 been reduced?
I can't seem to be able to select an icon for an added command, nor set it to be icon-only. Previous versions of Visual Studio supported this functionality and even allowed the creation/editing of custom icons.
Is this something that has suffered as a result of the move to the WPF-authored UI or am I missing something?
Seems like this functionality was cut from Visual Studio 2010. This post has some info in the comments: Customizing Visual Studio 2010
Specifically - "Unfortunately assigning or editing icons to commands through Customize dialog is not possible in VS2010. It is one of the features got cut for lack of time. This is however something we'll consider adding back in next version."
The reply also has a longer explanation of a workaround.
As noted in the link mentioned in the answer from #Gordon Mackie JoanMiro, the REASON for the reduced functionality is that the VS Shell team migrated the entire UI (shell and command system) from Win32 to one based solely on WPF. This was a gargantuan task, I would imagine. However, a couple workarounds are now available:
You can export previously saved settings from VS 2008 and import them into VS 2010. That includes command bar customizations (as noted by #Don)
A more recent blog-post contains detailed instructions for using a new extension to VS2010 (available on Visual Studio Gallery) that allows users to change the images on the command UI. (Note that the old drag&drop customization interface is still not supported in this new extension.)
If you have custom icons, any attempt to make ANY changes to the tool bar will result in the custom icons disappearing and being replaced by text when you restart VS2010.
The only way I found to get my custom icons without text into VS2010 is to open VS2008, set up all of the tool bars the way I want, including custom icons, then export the settings (Tools| Import and Export Settings). Then open VS2010 and import those settings. Tedious, I know, but it allows me to have a down arrow icon that searches for the next instance of the word my cursor is on.
I have been trying to customize VS2010 toolbars/keyboard and what took a few minutes in previous versions takes hours now. The new system looks real pretty but is useless in practice. Apart from the fact you just can't do (like change the appearance of buttons as mentioned above) the things you can do are extremely time-consuming and annoying.
Why is it every new version of VS loses something really useful? Other examples:
VC++5 introduced a new HTML help system. Pressing F1 on a function name used to immediately show help for that function. After VC++5 getting context help became annoyingly much slower, and is still very slow (and inaccurate).
VS.Net (aka VS2002 or VC++7) had a useless bookmark system compared to VC++6. VS2010 bookmarks are better but not perfect.
VS.Net removed the search state buttons "whole word", "case sensitive" etc. These were possibly the most useful buttons ever as they quickly allowed you to see why a search may have failed.
I found a great extension: CommandingImage
It does not have an icon editor, but you can create your images as 16x16 png format (for transparency) and import it (I recommend Paint.Net)
Dave, here's how to add toolbar buttons:
1) in the IDE, find the down arrow looking thing on the far right of a toolbar and click on Add Remove Buttons, Customize
2) in the Customize window select the Menu Bar radio button then select the appropriate menu bar that you want to add a button to
3) click the "Add Command..." button
4) select the appropriate Category and Command button that you want to add, then click OK.
The command button you selected will be added to the menu bar you selected. You can move the button up or down.
I think this is what you are looking for.
Good luck!

How do I view Visual Studio BuildLog.htm files without cutting and pasting into an external browser

This may or may not be specific to VS2005 (as that is the version I'm referring to for this question).
I find often the case is that I see this in the Output panel inside Visual Studio
2>Build log was saved at "file://c:\\vsdll_example\MyExecRefsDll\Debug\BuildLog.htm"
Now, since that looks and smells like a URL, I would have thought that I could simply left mouse click on it, or left mouse double-click on it, and a browser window of some sort would be displayed. No, that doesn't work. So, to view it, I have to cut and paste the "file://bla/bla/bla" part into an external window.
Is there a way to set up Visual Studio to allow me to browse to that file directly, or view it inside Visual Studio IDE, or something to that effect, without the extra fiddling with cutting and pasting? Or is there some type of keybinding I'm not aware of?
Thanks,
bg
Hold down Control while clicking on the link. It should show up in the editor.

Visual Studio 2005: Please stop opening my CS files in "Design Mode"!

I think it's associating my Web Service's CS files with the related ASMX files. But whatever's happening, I can't double-click to open the CS files - I have to "view Code" or it opens in the designer.
Anyone know how to turn off this automatic behavior? I just want to edit the code!
Try right-clicking, select "Open with...", mark "CSharp Editor" and select "Set as Default".
That works for avoiding the WinForms Designer.
I found this question when trying to deal with a similar problem. I had a C# class in a file and whenever I double clicked on the file it would try to open in design mode but design mode was meaningless for this class. I just want to see the code.
I found that adding the [System.ComponentModel.DesignerCategory("")] attribute to my class fixed this.
In the Solution Explorer view, click the "Show All Files" icon. This will put "+" symbol next to each of your files. Click the + and it will expand to show the .CS file which holds the ASMX's code. At this point, double click that file instead.
For some reason VS2005 seems to have this a bit backwards when it comes to webservices. To open a webservice in code view, double-click the .asmx file, not the .asmx.cs file.
I guess it makes a bit of sense, as there's nothing to "design" when it comes to a webservice, but it's counterintuitive if you've been working with .aspx files.
In my experience, if you find that the wrote editor, that is the non-default editor, is opening when double-clicking on a file within the Solution Explorer then something is wrong with the underlying project's User Options file (.user) or the solution's User Options file (.suo). (I am not sure which, but I suspect the settings are stored in the .suo file.) Deleting the the .suo and all project .user files solved the problem.
I personally, set the Form Editor as my default editor for forms at the beginning of a project. After the forms are stable and require less user-interface design changes, I switch the default editor.

Resources