Friday, December 19, 2014

Source Code file editing with Visual Studio Online

Brian Harry, on his blog, has announced the new release of Visual Studio Online. One of the new features is the long-awaited code edit directly from the web portal.
Let see how it works.
 
 
Edit
On the Team Project's Dashboard, go to the "Code" section and click on a source code file from the tree menu on the left.
 
As ever, the read-only source code box will appear on the right pane. Unlike what happened previously, however, there is a new "Edit" button.
 
 
Clicking on it, three things happen:
  1. The toolbar changes
  2. In the tree left menu the selected file is marked with a * to let you know it's in editing mode
  3. In the right pane is now possible to edit the source code

 
 
When the editing is completed, it's possible (recommended...) to write a comment for the checkin into the textbox and then click on the "Save" button of the toolbar.
 
Click on "Save", the changes will be saved in the source control; it creates a changeset and shows a tooltip with the info about the result of the operation and a link to the changeset view page.
 
 
It's also possible to cancel the editing, just click on the "Discard" button in the toolbar.
Finally, if we want to verify our changes before doing the checkin, we can make a diff between the file on the source control and our version with the button on the far right of the toolbar.
 
 
 
Upload, Create, Rename, Delete
In addition to directly edit the source code, you can also rename, delete and create a file or folder and upload new files.
 
 
To creare a new file or upload it, just right click on a folder and choose "Add file(s)".
A popup will open, here you can select to create a new file or to upload existing files.
 
 
To cancel a file or folder right click on it and click on "Delete" from the contextual menu (it asks for the confirm).
 
Finally, to rename it click on "Rename" in the same contextual menu.
 
All these operations will generate a changeset, so all the changes will be mapped and historicised on the source control.