Can't drag files (js/css) from solution explorer into view - visual-studio-2013

Just installed update 1 of vs2013 and now I can't drag .js or .css files from the solution explorer into my html views anymore.
Before you could do this and vs automatically created a script tag or link tag to the file. I'm not sure if it has something to do with the update 1 but I really miss that now, is there a way to re-enable it?

I had this problem in VS 2015; resolved by (re-)enabling:
(Menubar) Tools -> Options -> Text Editor -> General -> "Drag and drop text editing"
This not only affects the ability to drag and drop highlighted text (which is why I had turned it off in the first place), but also the ability to produce an automatically formatted link by dragging and dropping a file onto the editor window. There may be a way to separate the two, but I have not come across it.
The same option is present, by the way, in the same location, in VS 2012. However, I did not test the behavior of the option in that version.

I had the same problem and this is how I fixed it...
Option 1:
Go to Tools > Options > Text Editor > File Extension
...and add the extension of the file you are editing. In the editor selection list choose HTML Editor if it is an html or quivalent code you are working on... or just select the kind of code you are writing. After that hit Ok, restart VS and it should work now...
Option 2:
Right click on the file and select open with HTML Editor, save as default, and that should work as well.
Cheers

Try running as administrator, if you are not already.
I had this same problem. I tried #VictorSuarez's solution of adding the edited file's extension to the list of files to opened by the HTML Editor, but it did not immediately solve the problem. I then opened Visual Studio as an admin and was able to drag and drop links as expected.

For vs2022 this should be fixed in: Visual Studio 2022 version 17.3 Preview 3. Accordingly with quote from "Fixed - Pending Release" developer community issue from Jul 13, 2022:
A fix for this issue is now available in preview release. Try out the
fix by installing the most recent preview from
https://visualstudio.microsoft.com/vs/preview/ .

Related

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

VS 2017: Double click in on changed file opens it instead of diff tool?

I'm using Visual Studio 2017 (latest version 15.5.3) and Beyond Compare as a diff tool and git as version control. Usually, when I double click on a changed file in the 'Changes' window, Beyond Compare opens and the diffs are shown. A couple of days ago the behavior changed. Now a double click opens the file itself in the editor instead of opening my diff tool.
When I want to view the diffs, I have to select 'Compare with unmodified...' from the context menu. So the diff tool itself still works fine. Only the behavior of the double click changed, which is quite annoying.
I searched the settings for a configuration, but didn't find anything.
Did anyone experience the same behavior?
How can I change it back?
Kind regards,
Ash
Strange no one else had this problem yet...
Finally, I downloaded the VS installer and executed repair option. After it finished, the problem disappeared.
Click on ... in Git Changes tab to the right of "Changes" word and choose "Compare File as Default Action".

Disable HTML element tooltips in Visual Studio

I was wondering if anyone has had any luck disabling the HTML element tooltips in Visual Studio 2015. I find them to be a real annoyance, especially when dragging/ctrl+dragging text around (they get in the way most the time). Here's a screenshot the feature in action (updated):
I Googled and was only able to find the post where the feature was announced, but no mentions of how to disable it. I checked my Visual Studio preferences and have "Auto list members" and "Parameter information" disabled for the HTML text editor.
Any ideas or suggestions?
Update (10/16/2015): I think this issue may be related to the Web Essentials package. I disabled the package and was able to make the tooltip show up, however, I don't currently have a computer with a default Visual Studio 2015 install to test my theory on. I updated the screenshot to reflect the actual tooltip I'm getting (the original one was the screenshot included in the linked blog post).
Try this:
Go to: Tools > Options... > Text Editor > HTML > General
In the 'Statement completion' section you will see an 'Auto list members' checkbox, uncheck it.
However, I'm not sure if the feature above reffers to an in-design html editing or will only affect in specific html development environment (editing an html file for example), so I'll give an additional solution:
Go to: Tools > Options... > Environment > Keayboard
Here, find the command Edit.ToggleCompletionMode and assign the keyboard shortcut that you desire.
Then just use it when you wish to toggle the auto completion of members (including html members I supose).
Update
Sorry If I confussed what you want, because with the absence of auto completion it will remove existance of tooltips but I don't know if you need auto completion suggestions or not.
Anyways, for tooltips you could try doing the same procedure I explained in the images above but with the "Parameter Information" checkbox and/or the corresponding keyboard shortcut, Edit.ParameterInfo. Because seems that html element tooltips are treated as parameter info.
This was annoying the Hell out of me as well & I found that ElektroStudios' solution wasn't suitable in my case. I'm fairly sure that they are VS-native (definitely not Web-Essentials or ReSharper).
For VS2015 at least, the offending tool-tips are located within the file:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Schemas\1033\HTML\html.loc
Deleting the contents of this file has "disabled" the tool-tips for me, although I can't say whether this will be a permanent fix.

How can I save opened tabs and tab groups in Visual Studio 2012?

I need to have different set of open tabs and tab groups for each of my tasks.
Import and export setting not helping me to do this, neither does this SO question that has been asked similarly but for windows/tools layout - i.e. NOT for the tabs/tab-groups.
How can I save and restore the saved set?
Late to the party here but it popped up pretty high in my google search for this kind of thing so I'll drop my find: Save All The Tabs.
One Marketplace Extension that works with Visual Studio 2013, 2015, 2017 and 2019 is the Workspace Manager.
One additional tip: after installing it and adding the toolbar, you might have to restart VS again until it fully works (see Q & A). At least I had to do so in VS 2019 (16.1.3).
You can save open documents and later reopen them as a group with the Favorite Documents extension.
Really late to the party but ContextKeeper plugin will do the job. Supports VS 2022/2019/2017/2015/2013.
It's an extension to quickly save and restore sets of document tabs and its metadata. The "session", similar to Vim's :mksession command, is defined as:
last opened/favorites files
documents (tabs with code) positions, state and order
tabs groups (including horizontal/vertical orientation)
remembers line&column for every opened tab
It also has a powerful git integration - automatically saves and restores context when switching between branches.
All contexts are saved to simple JSON files.
If you accidentally came here looking for a VS Code solution, from the same author of Save All The Tabs (for Visual Studio) that MushKov shared in this answer:
Restore Editors extension
press Ctrl/Cmd+K and Ctrl/Cmd+E to access the editors/tab menu

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