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

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.

Related

How can I open the Visual Studio EditorConfig Designer after changing the default editor for the .editorconfig file type?

Does anyone know how to either add back in the EditorConfig Designer as a program to open files with or how to reset the default editors for file types?
After changing the default editor for .editorconfig files to be something other than the EditorConfig Designer the option to set the default editor back to the designer or to open with the designer is now gone.
I know I can probably delete my appdata folder or something like that and reset it that way, I'm looking for a way to do it that doesn't take doing that. I did a quick search in some of the xml files visual studio uses but realized it would take some time to figure out exactly what to do to add it back in myself, thus I'm asking with hopes someone has experience doing this.
One work around I have found is to set the files to open with a text editor with text encoding then hit cancel when it asks which encoding to use. It then opens the designer but it still won't show up as an option to set as the default or in the open with items, which is what I want.

Visual Studio View Code on Multiple Files at Once

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

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.

"Save Copy of Package as..." option missing

In Visual Studio 2005 Professional, under Menu Bar "File", I do not have the option "Save Copy of Package AS..." which allows saving the package on the server. How do I get this option to display and be useful?
Do you mean "Save Project as..."?
If so, yeah it's kind of a pain moving a VS project. I usually just copy the directry tree using normal file copy commands, and fix up whatever problems crop up as a result manually. Usually it's not bad - most of the project information deals with relative file locations pretty well.
Kinook Software has a utility that's supposed to help with this. Try it if you think it has value:
http://www.kinook.com/CopyWiz/
You could activate it by customizing your menu. See http://asqlb.blogspot.com/2010/12/save-copy-as-is-not-option-visual.html
If grayed out, drag the selected option to the file menu and drop it under "save as".

How do I edit work items in the Visual Studio 2008 xml editor?

I'm trying to customize some TFS work items via the VS2008 xml editor, but every time I open a work item xml file it jumps to the graphical designer. All that gives me is a "View XML" button that doesn't let you edit the xml directly.
I don't have TFS but I know in regular VS there is an Open With... option in most items' contextual menu that even let you change the default editor. Very useful when you are tired of the Designer opening instead of the Code file on Windows forms.
Ah, looks like you have to go to File->Open and click the down arrow next to the Open button to "Open With" the xml editor. If someone wants to copy and paste this, free accepted answer :P
As per Coincoin's answer, this feature is also great for setting the default editor for ASPX. If you want to go to the Code Editor most often, then this is a default you'd want to change.
Reading this - I think perhaps you don't realize - that there is no need to edit the XML - in fact it is very difficult to do so. The graphical designer will actually let you change the Work Item type, adding new fields, changing workflow, rules etc.
The only reason to change the XML is if there's a bug in the Process Editor (the tool that gives the graphic designer). I have done extensive modifications of Work Item types and only had one instance where I had to change the XML.

Resources