"edit, build, refresh browser" approach in visual studio 2017 - asp.net-mvc

New_bie_developer_from_php_background.
I am developing an asp.net MVC web app using vs2017 community edition.
I want to make my development environment in such a way that I can edit code, build and refresh the browser to see the changes and again you can edit without stopping the server.
But in VS the approach is different. You have to stop the server, edit code, start server again (which makes the server code uneditable).
Does the vs can be modified to match my requirements? ie to edit, build and refresh the browser.

Partial solution can be to start your app in a Launch without Debug mode (Ctrl+F5).
That way, ASP.NET will be automatically picking up changes you are making in your code. However, in this mode you will lose debug features (hitting breakpoints, getting debug-related messages etc.).

There are two ways to do this. First is to click on pause
or use keyboard shortcut keys (Ctrl+Alt+Break). Edit your code and click continue.
Second is by go to Properties of your project (by right clicking project in visual studio's solution explorer) => select Web from left nav and check the Enable Edit and Continue checkbox. Now you can add break point and when it get hit you can edit your code. Now Refresh your browser.

Related

How can I stop Visual Studio 2019 from changing the start up page whenever I click in solution explorer?

There are many aspects of Visual Studio which are irritating, but one of the most frustrating is that the start page changes whenever a page or folder is clicked in the solution explorer. When the start page is set it should stay as the start page unless the user specifically changes it. What is the point of having 'Set as start page' in the right-click menu if you can do this just by clicking the folder or page?
I'm fed up of constantly having to correct the start page every time I want to run the code. Does anybody know if there is a way to fix this behaviour?
Edit: Looks like it's not just clicking in solution explorer that does this, but clicking an open file as well

Visual Studio 2019 and Git Update View Problem

I'm developing a ASP.Net MVC 5 application using Visual Studio 2019. I also am using Git and GitHub with this project (first time - previously I have used TortoiseSVN).
I've noticed that when I make a change to a Razor View, a red tick will appear beside the file in Visual Studio to signify that something has changed within the View.
However, I can only see the changes I've made within the View if I stop debugging, and then restart. Normally I could make a change to the Razor View whilst debugging, e.g. a text change, Save the Razor View within Visual Studio, and then F5 or Ctrl F5 within the browser and the page with refresh with the latest text change.
For some reason I believe this is related to Git because I have other MVC 5 applications on my laptop within the same folder structure which are not using Git, and this problem does not exist.
Surely I don't have to stop debugging and restart every time I want to see a change to a View?
Could someone please help?
Thanks.

'View in Browser' with Razor and MVC in Visual Studio

I'm currently playing with Razor and MVC in VS 2017, but, unlike aspx pages, I can't simply view in browser to see what it looks like when rendered, instead I have to copy it to the host and view it live on the internet.
Is there a way to view in browser without publishing it remotely?
Thanks
In Visual Studio, from the main menu select:
View -> Toolbars -> Standard (Make sure Standard is checked)
Just below the main menu, you should see a row, or many rows, of icons. You want to look for a green arrow icon. After locating the green arrow and clicking on it, Visual Studio will attempt to first build your project, which if successful, will then proceed to run your project in localhost. If it doesn't build you will be notified and you can review the Error List tab at the bottom of Visual Studio as to the reasons why.
After a successful build, Visual Studio will open your default browser automatically and redirect itself to the localhost and port number of where your application is running. You should now see your application running. It will have a url in the browser something similar to the following https://localhost:5000/

How to View a TFS Work Item in MS Project in a Visual Studio-like Form

I'm using MS Project to manage my TFS work items. The standard Summary Task Information window that comes up when double-clicking on a task is slightly inadequate when dealing with TFS work items. It lacks the standard work item view that we're accustomed to within Visual Studio, and that MS has elegantly rendered within visualstudio.com.
I noticed today that if I set a task field to invalid value, then Work Item Publishing Errors window comes up and there's a nifty little button Edit Work Item... that displays the work item in the standard VS view. Now I'm searching all over Project to figure out how to edit a work item in this view without first having to cause a publishing error. There must be some button I've overlooked in Project that opens a TFS work item up in the VS-like view, isn't there?
It's currently not possible and its also not intended to be used that way. The UI in Ms Project is the native Project UI and is mant to receive the updates to the plan and to layout the items into a new plan.
Managing the contents of the items is all meant to be done from the Web UI. With the new Work Item UI you'll be redirected to the Web whenever you need to edit a work item. Visual Studio, Excel and Project won't show you a native editor window anymore.
You'll be able to directly to the work item editor on the web from the team tab. When connecting to older versions of TFS, this would open the Work Item editor:

TFS build definition freezes when connecting remote machines

When connecting to a remote TFS 2010 installation via my Visual Studio 2010, Process tab of Build Definition freezes. Everything seems to be disabled. Is there any work-around?
UPDATE 1:
By freezing I mean:
I can navigate to all tabs: General, Trigger, Workspace, Build Defaults, Process and Retention Policy. Except for Process tab, they all are working as excpected. When I click Process tab, it is showed, but none of parameters are shown, and the tab itself is in gray. Actually nothing could be clicked. It is like that Visual Studio is waiting for something to be completed or loaded.
UPDATE 2:
I have explored that when I leave Visual Studio alone for a long time about 20 or 30 minutes, the Process tab goes normal. That means all parameters appears and can be edited. That seems downloading or getting something from server causes this very very long delay.
You might want to check out exactly what rights you have on that server with regards to administrating builds.
http://intovsts.net/2009/09/03/more-fine-grained-permissions-in-tfs2010/ and
http://msdn.microsoft.com/en-us/library/ms252587.aspx
I think one of the main ones is "edit build definition"
If you don't have rights, then there won't be a workaround.
UPDATE:
The only things I can really think of at this point is to put a sql monitor on the TFS Database and possibly, watch the network traffic to see how the network interface is being used.
It's possible that something is wrong on the database server causing a huge amount of load. The other possibility is that the network is badly configured and running at 1Mb instead of 100Mb+.
Beyond those, I'd say call MS Support and open a trouble ticket. This is by no means normal and is likely indicative of some underlying hardware or installation issue.
Afsharm,
Happend with me too. This happened when i had the build defination open on one VS instance in edit mode and i opened it for editing on another pc. After a while it errored saying "TFS 20391: Locked for blah blah..." I had to close my visual studio instance on both the machines and restart, it worked there after. These are very occassional cases and very hard to replicate. I would suggest restarting your visual studio session and trying again.
PS - Worth checking if some one else have the process template open for edit as well?
HTH.
Cheers, Tarun

Resources