Stop visual studio opening layout page everytime I refresh mvc web app - visual-studio

I'm using Visual Studio 2015.
If you create a new MVC project with all the basics it gives you (home controller, account controller, etc..), then press F5 to start it, visual studio shows the "_layout.cshtml" page in a preview window.
This gets rather frustrating if you're trying to make "on-the-fly" changes to a specific view, press F5 to refresh and see your changes, then alt-tab back to visual studio, only for it to have auto-previewed the layout page again.
How do you turn this feature off?

In Visual Studio, you should disable the checkbox for 'Enable browser link'.

I was able to reproduce on a new install. For me, the offender was "Web Essentials" extension. Try to disable and restart VS.
Also, it only happens with Edge's developer tools open. Haven't seen this with Firefox nor Chrome.

This is caused by the F12 Developer Tools where the page of the selected element in the DOM Explorer/Elements tab is automatically opened and synchronized in Visual Studio.
If you want to keep the Browser Link feature enabled, the F12 Developer Tools window open, and not lose your currently focused tab in Visual Studio, here's a work-around:
1. Right-click on the _Layout.cshtml tab in Visual Studio and select New Vertical Tab Group.
If you already have a tab group open, select Move to Next Tab Group.
2. Resize the splitter control of the tab group so that the tab group is barely visible.
3. Repeat these steps for all other files that automatically open in Visual Studio which disrupt your workflow.

I am unable to replicate your exact problem, but the following should disable the preview tab:
Type "preview" into Quick Launch
Select "Environment --> Tabs and Windows"
Disable "Allow new files to be opened in the preview tab"

Related

Web Publish Activity window is not maintained when closing and reopening Visual Studio 2022

I recently applied an update to Visual Studio Community 2022 (64-bit).
Current Version is 17.3.4
We still use Web Deploy for some legacy asp.net sites and the Web Publish Activity window is very useful for switching between dev and production environments.
After a recent Visual Studio upgrade I noticed that the Web Publish Activity window was not visible, so I reopened it via View -> Other Windows... and it appeared as expected in the lower window, as a new tab along with Output and Error List.
But after closing my project and reopening it, the Web Publish Activity window is missing again. I tested other windows like PowerShell and Bookmark Window and they ARE maintained after closing and reopening VS.
I also tried saving a new window layout with the Web Publish Activity window open and then reapplying that layout after a VS restart but that had no affect.
It is very annoying to have to go though multiple levels of the View menu to reopen this window every time I open this project.
Does anyone have any advice on how to keep this window locked/pinned?
Is Microsoft trying to "encourage" me to stop using this window?
If there is another way to quickly change between publish profiles that would be acceptable as well, but I cannot find one.
Thank you.
This may be a bug with this particular window (the fact that it doesn't stay pinned after closing Visual Studio that is).
Perhaps as a decent workaround you can at least assign a keyboard shortcut to open this window:
Go to Options → Environment → Keyboard
Filter down to "View.WebPublishAcitvity" or find it in the list
Create a keyboard shortcut of your liking by typing it in the circled red box and then click the Assign button:
After doing that, you should be able to use that shortcut to open the window much faster at least.

How to disable the document well in Visual Studio 2015?

The document well is the feature in VS 2015 that closes a tab automatically when you switch to a different tab, unless you click the "Keep Open" button in the tab.
I find this very annoying, because often I will open a tab during debugging only to have it disappear after which I have to go hunting for the file again.
Is there a way to disable this feature, i.e. to keep all tabs open permanently, the way VS 2013 did?
I've looked in Tools\Options, and also did a quick web search, but couldn't find a way to do this.
Uncheck the Allow new files to be opened in the preview tab option:

VS2013 disable Web Publish Activity windo

Is there a way to disable the Web Publish Activity window in Visual Studio 2013?
I couldn't find any options to disable that feature.
I have no directly solution for it. But I found workaroud: I tab it to the right sidebar and set autohide for it. So, now this window take minimum screen place and isn't shown during every publish:
If you click the little x in the Web Publish Activity window, it will go away!
I had the same problem on Visual Studio 2017.
Mine was over everything every time and completely unreactive. Not even its close button worked.
The way I get rid of it was: menu Window > Reset Window Layout

Visual Studio 2012 change web browser

If I click control-click a hyperlink in the text editor, it opens the URL in a new Visual Studio tab. I would rather the link open outside Visual Studio in my system's default web browser (happens to be Google Chrome). How can I arrange this?
I'm talking about hyperlinks in code comments.
I am using Visual Studio 2012. I found a similar question dated 2009, however the accepted answer (a macro) doesn't work in Visual Studio 2012.
Frustratingly, this isn't possible in Visual Studio 2012 or 2013.
Bug reported to developers at http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2723548-open-links-in-an-actual-browser Please add your vote!
There is an extension Open in External Browser.
I'm using Visual Studio 2013 Professional. It works for me.
To install:
Go to "Tools" - "Extension and Updates..."
Choose "Online" - "Visual Studio Gallery" on left pane
Type in search field "open in external browser"
Click "Install"
It seems that it is not possible (except if your default browser is IE, so you would not know the difference).
As Anand wrote above, you could ctrl + right click on the link and then select open link in external window (you cannot do that on the start page, only on an opened webpage) but it still opens the window in IE no matter what your default browser is.
Even if you go to TOOLS --> Options --> Environment --> Web Browser, you will notice that it indicated that IE and the internal VS web browser are siblings.
So just copy the URL from the address bar and paste it to your default browser (it's not too much trouble in my opinion).
In VS 2012 Professional, on the toolbar next to the run debug icon, is the word 'Start' which can be expanded. When expanded you have the option to 'Open with...' and you can select the browser to open the web project up in. It does not run the debugger, it only opens the website in the selected browser. (toolbar > Start (expanded) > Open with...)
You can use the default browser switcher application if you are using Visual Studio 2010 for this kind of situation:
On your tool bar menu select "TOOLS"
Then from options choose "EXTENSION Manager"
It will open the extension manager window in the left hand side there are options choose the "Online Gallery" option
In Online Gallery search for "WoVS Default Browser Switcher"
Download it and Install it
After download restart VS
Hope this works best for you
I found a way to change the default browser for all actions in Visual Studio Express 2012 for Web. It's documented here:
By default, Visual Studio uses your default browser to test pages. To use a different browser or Page Inspector, right-click [an .aspx] page in [the] Solution Explorer and then click [...] Browse With [, which] lets you select a browser from a list, add new browsers to the list, or set one as the default browser. (The default browser setting here applies only to the Visual Studio environment and not to Windows.)
This also changes the default browser for F5'ing an MVC project, because I'm used to closing IE to stop debugging. When I let Visual Studio use my system's default browser, I first have to switch back to it from my browser to stop debugging, because closing the browser tab doesn't.
Unfortunately it still doesn't open links in comments in a browser.
I don't actually know what you mean under hyperlink, but you can easily make VS2012 working with another browser by simply.. uninstalling IE9 (Control Panel->Software->Windows components->bye bye IE9).
Well I found a workaround that is not so clean :P
Add a .html file to your project
Open the new .html file and click inside the editor.
Now Goto 'File' > 'Browse With...' from the Visual Studio Top Menu.
In the 'Browse With' Window, select the desired browser and click
the 'Set as Default' button.
Click the Browse button to set the new default selection.
This is what you have to do:
Go to the standard menu toolbar
Click on 'Add or Remove Buttons'
Tick the 'Debug Target' option
VS 2012 -->> File -->> Browse With -- >> Select Browser -->> Click on "set Default" Button -->> Now Click "Browse" Button
Go thru this setting...
Hope this will help you

Change Visual Studio 2010 Web Browser View to Firefox

Visual Studio 2010 has an integrated web browser view: Menu->View->Other Windows->Web Browser. How can I change this browser to FireFox?
Context: My goal is to have my favorite browser, as installed on the hard disk, integrated in Visual Studio. Doing so I could browse my favourite web sites the way I like, while coding. Visual Studio typically fills up my 2 screens, and using this, I could keep my browser in the foreground while not leaving visual studio.
PLEASE! Note: This question is not about the WebBrowser control usable in .NET WinForms/WPF projects, nor about testing my own code in a different browser.
Ok Here is a Manual solution to Add a new Item named Web Broweser in the Other Windows menu...
In the Tools Menu, Select External Tools...
Select Add in the opened Dialog Box...
Now Edit According to the the Fields :
Title : 'Mozilla Firefox'
Command : [Browse to the file 'firefox.exe' in the Mozilla Firefox Install folder (Default = C:\Program Files\Mozilla Firefox\firefox.exe)]
Arguements : [NULL("")]
Initial Directory : [Path to Mozilla Firefox Install Folder (Default = C:\Program Files\Mozilla Firefox\)]
Click on Apply and then on OK.
Note the Serial No. [Index] of the Entry Mozilla Firefox in the Tools Menu.
Now, In the Tools Menu, Select Customize......
Browse to Commands tab.
Select the RadioButton MenuBar and in the adjacent ComboBox, Select View | Other Windows
Select WebBrowser in the Controls ListBox and Click on Add Command...
In the Categories ListBox Choose Tools.
Now remember the Serial No. [Index] of the Entry Mozilla Firefox...
Find the Entry corresponding to External Command Index..and Select that Entry.
Click on OK.
See A new Item External Command Index has been added...
Click on Modify Selection...
Change the Name property to Web &Browser or Web Browser
Click on Close.
Check the View --> Other Windows Menu...You will find Two MenuItems with name Web Browser...
The First Item [Without the Icon] is the Newly created Firefox Shortcut...
I have found the "Always on Top" Firefox extension, which helps to keep Firefox in place and visible while fiddling with the code in Visual Studio.
Get Always On Top.
This helped me so far, even though it is not what I initially looked for.

Resources