Can I hex edit a file in Visual Studio? - visual-studio

I want to edit a binary file, but I don't want to use another tool other than Visual Studio because it's a pain to switch back and forth.
Is there perhaps an add-in or some built in functionality that can do that in Visual Studio?

Menu File → Open → File
Select the file to be opened
On the open file dialog at the bottom there is a down arrow on the "Open" button
Click "Open With..."
Click "Binary Editor"
Click OK
Or for the keyboard geeks out there:
Ctrl + o
Ctrl + v (paste filename)
tab
tab
↓
w
b
Enter

In addition to Kevin's answer, with Visual Studio 2017 you need to have the Visual Studio C++ Core Features component installed.
Source

Another way to do it is to rename your file to .bin and drag it into VS editor

right click the file in Solution Explorer,
select 'Open With...'
select 'Binary Editor'
Let's enjoy the hex world :)

Related

Visual Studio Solution Explorer, selected file changes when I click into Main Coding View [duplicate]

In my Visual Studio 2012 Solution Explorer, when I single click a filename it opens it. This was different from Visual Studio 2010 (required a double click). Is there a way to make double-click the 'view file' command?
This is called the Preview Tab feature. To change that behavior, go to:
Tools -> Options -> Environment -> Tabs and Windows
Then look for the "Preview Tab" section, and uncheck the options therein:
Option 1: Using icon in Solution Explorer
You can enable or disable the feature in Solution Explorer using the "Preview Selected Items" button.
The icon is a Tab aligned to the right.
Option 2: Using the Options window
You can enable or disable the feature by going into Tools > Options and then Environment > Tabs and Windows.
The Single-click opens files in the preview tab text mentioned in rubber boots' answer is missing in VS 2015. Mysteriously, a search for "single click" still brings up the Environment > Tabs and Windows option.
So for VS2015 and VS2017, either click the button in Vinicius's answer, or uncheck the Preview selected files in Solution Explorer box shown in the screenshot below.
In Visual studio 12/13, easiest way is to type "single click" in quick search and than select Tabs and Windows.
And in Tabs and Windows dialogue ,uncheck "Preview selected files in solutions explorer"
Shortcut Ctrl+Alt+Home.
If you press that in a document that was just opened, it will be opened permanently.
Item -> right click -> Open With -> Source Code (Text) Editor -> press Set as Default button
It's no longer there in VS2019. You enable/disable it through "preview selected Items" in Solution Explorer.

How to open file with double click in Visual Studio?

By default if you navigate in Solution Explorer and just point on some file Visual Studio immediately open this file for editing. I would like to change this behavior and open files with double click
Like written here (but it for VS Code)
https://stackoverflow.com/a/57233522/5709159
How to change this settings?
In "Solution Explorer", click on "Preview Selected Items".

Shortcut in Visual Studio to open solution in Windows file explorer?

Is there a keyboard shortcut in Visual Studio (currently using 2013) to open the solution (or a project) in the Windows file explorer?
Currently, I normally have to open up the Solution Explorer, right-click on my solution or a project and scroll down to 'Open Folder in File Explorer', but this becomes a time consuming task as I have to do it often (TortoiseGit not integrated with my IDE).
An improvement over #Walt_Ritscher's answer I found was to assign a keyboard shortcut to the File.OpenContainingFolder.
Instead of having to first select a project or solution from the solution project I can simply press a desired keyboard shortcut while any file is in focus (without having to open the Solution Explorer) and it will open the file location in Windows Explorer. This saves time if the focus in my solution explorer is on a file deep in the structure of my solution explorer since I don't have to scroll all the way back up to select a project/solution before hitting the keyboard shortcut.
Yes, you can add your own keyboard shortcut to open the folder.
Open the Tools/Options/Keyboard dialog. In the Show Commands Containing textbox, type OpenFolderIn and you will see the OpenFolderInFileExplorer command. Select the command, then assign a shortcut key. Move your cursor to the Press shortcut keys textbox.then press your desired key combination. In my example I chose Ctrl+Shift+'. Be sure and click the Assign button to memorize the shortcut key
Press OK and you're done.
For visual studio vs2017:
Ctrl+Shift+Alt+O

How to stop Visual Studio from opening a file on single click?

In my Visual Studio 2012 Solution Explorer, when I single click a filename it opens it. This was different from Visual Studio 2010 (required a double click). Is there a way to make double-click the 'view file' command?
This is called the Preview Tab feature. To change that behavior, go to:
Tools -> Options -> Environment -> Tabs and Windows
Then look for the "Preview Tab" section, and uncheck the options therein:
Option 1: Using icon in Solution Explorer
You can enable or disable the feature in Solution Explorer using the "Preview Selected Items" button.
The icon is a Tab aligned to the right.
Option 2: Using the Options window
You can enable or disable the feature by going into Tools > Options and then Environment > Tabs and Windows.
The Single-click opens files in the preview tab text mentioned in rubber boots' answer is missing in VS 2015. Mysteriously, a search for "single click" still brings up the Environment > Tabs and Windows option.
So for VS2015 and VS2017, either click the button in Vinicius's answer, or uncheck the Preview selected files in Solution Explorer box shown in the screenshot below.
In Visual studio 12/13, easiest way is to type "single click" in quick search and than select Tabs and Windows.
And in Tabs and Windows dialogue ,uncheck "Preview selected files in solutions explorer"
Shortcut Ctrl+Alt+Home.
If you press that in a document that was just opened, it will be opened permanently.
Item -> right click -> Open With -> Source Code (Text) Editor -> press Set as Default button
It's no longer there in VS2019. You enable/disable it through "preview selected Items" in Solution Explorer.

Visual studio or resharper shortcut to close currently selected file in IDE

Is there a shortcut in VS 2005 or resharper to close the current file. or "save and close" would be even better
Ctrl + F4
Save and close would
Ctrl + S followed with Ctrl + F4
Visual Studio 2015 + Resharper
The question is a bit old. Just wanted to update it with the current solution.
As you can see below, you can also completely customize your shortcuts:
just navigate to Tools > Options
on the left pane, go to Environment > Keyboard
now use the field Show commands containing to search for file.close
select File.Close on the list
click the field Press shortcuts keys
type your desired shortcut, for example, <Ctrl> + W
finally, click Assign
And you're good to go!
Ctrl+S, Ctrl+F4 will save and close the current file.
Tools -> Options -> Keyboard
Find "Windos.CloseDocumentWindow"
And for me, need to set "Use new shortcut in" to "text editor" to override old ctrl+w without delete

Resources