Mandatory Code Review in VSTS - asp.net-web-api

We are migrating our project in VSTS and we are having a hierarchy in our team. Is it possible that developers can check-in the code only after their team lead reviews the code.
Before a developer Check-in, a notification/email is triggered to team lead with the detail of changeset, and after the approval/review comment only he can check-in.
I am using Visual Studio 2017, TFS and VSTS.

For TFVC, you can use third-party check-in policy such as Colin's ALM Checkin Policies VS 2017 which works on your VS client (See How to utilize Team Foundation Server check-in policies). But it's client side policy, that means you need to apply the policy to each client.
So, to enforce/Mandatory the Code Review, you need to write the Server side policy. Just reference this article: How to Enforce Check-In Policies and TFS Server-side check-in policy for git repositories to write your own check in policy.
For Git, it's more easier by setting the branch policies to force code review:
Enable Require a minimum number of reviewers and add the team lead as the required reviewer under Require a minimum number of reviewers
Refer to Improve code quality with branch policies for details.

TFVC supports a Code Review workflow (although it's generally considered vastly inferior to the Git pull request/branch policy model, with good reason). There's no good way to make it mandatory, however. You can apply a third-party check-in policy, but the caveat is that check-in policies work only within Visual Studio and are relatively easy to circumvent by a determined individual.

Try Colin's ALM Checkin Policies VS 2017 for team foundation version control.

Related

TFS 2013 to TFS 2013 synchronization

We are trying to work on a solution to synchronize two TFS 2013
servers.
We have two TFS 2013 servers, one in the development environment
(let's say TFS 2013 Development) and the other in the production
environment (TFS 2013 Production).
We need to be able to:
Synchronize pieces of code from TFS 2013 Development to TFS 2013
Production on an as needed basis.
Synchronize the TFS tasks and work
items between TFS 2013 Development and TFS 2013 Production. This
should happen on an immediate basis and should be bi-directional. That
is, when any changes are made to the work items/tasks in either TFS
2013 Development or TFS 2013 Production it should immediately be
reflected on the other TFS server respectively.
We have started
looking into the above and tried using the TFS integration platform
for synchronizing code between the TFS 2013 development and TFS 2013
Production servers.
Hence we basically have three questions
Is TFS 2013 to TFS 2013 code/work item synchronization supported by the TFS integration platform tool?
How can we go about doing the Synchronization for the code
repositories and work items as described above for TFS 2013 to TFS
2013?
Is synchronization a new direct feature of TFS 2013, and can this
be done without any third party tools?
To start with, I don't understand the setup of your systems. TFS generally lives in 1 instance and 1 only. TFS is a production environment for the development team. It doesn't make sense to have two TFS systems and have them synchronize to make this separation.
If you need to create secure snapshots of your sources, you can create branches and secure these. If you need to promote the results, run a build and use the published build artifacts to install to the production environment.
Having your teams work on two different TFS environments at the same time is a very strange requirement.
To just answer your questions:
Now to answer your questions:
TFS Integration Tools
It's a feature of the tool, and as long as you use the TFS Integration Tools (the version available from the Visual Studio gallery), Microsoft provides paid support. The TFS Integration Platform doesn't come with the same level of support. The TFS Integration Tools do not synchronize all data between environments, work item Tags, Test Results, Check-in notes, Labels, Permissions, Workspaces, Pending Changes, Shelvesets, File encodings, Subscriptions, Test Cases, Check-in policies, Reports, Team Portal / SharePoint, Process Templates, Work item queries, Builds, Warehouse data are not supported.
setting up You'd setup two syncs, one bi-directional sync for work one one-directional for sources and pray. There are so many things that can go wrong in this situation, as the sync is not transactional across environments and certain actions can happen synchronously on both environments that will put you in a stuck state. Generally when syncing between two systems you'd make one system master for a specific piece of data and you son't touch them on the other environment. This scenario is a nightmare waiting to haunt you until you turn it off. For the source sync, you might opt for a manual checkout/checkin process instead.
Out of the box? No, this is not a supported scenario in TFS out of the box. There is the Integration tools (which you've already found) and there are a few 3rd party commercial tools like OpsHub and TaskTop.
TFS Integration Platform (March 2012 Release) supports only TFS2012
You can write your own synchronization tool using TFS API.
No. TFS2013 doesn't have this feature.

Visual Studio Online Local Backup?

I work from a small IT department and I'm pushing to move from our current TFS implementation to Visual Studio Online. My boss who gets the final say is hesitant because "What if Microsoft decides to stop offering the service, without notice, or their servers fail how will we get our code". While I find such a scenario unlikely and the scenario of our TFS server crashing and burning with no backups/bad backups much more likely. I still need to address his concern.
Does anyone know of a way to "backup" a remote TFS implementation? So far the only thing I've come up with is doing a nightly pull of Visual Studio Online and submitting it to a local repo, feels hacky, feels wrong.
Take a look over at the discussion on this StackOverflow question: Is There A Way To Backup Visual Studio Team Services Projects?
Here is Richard's answer:
There's no out of the box backup ability.
Now, if you are only referring to source control, and not work items,
pull requests, builds, test plans or anything else that the service
offers, then I'd suggest you migrate your code over to git.
With git every developer will have a complete copy of the source
repository, including all history and commit comments. From there,
it's a simple task to push the git repository to a different git
hoster (such as bitbucket or github) and make them your new centrally
hosted git repository.
On a historical note, Visual Studio Online at one point offered a data
export for a period of time. You might want to add a vote or three to
this related UserVoice idea to help raise the importance of the
feature with Microsoft.
Side comment: The business risks in using Visual Studio Online will
come from either Microsoft shutting down the Visual Studio Online
service or that the underlying Azure infrastructure has such a
catastrophic failure that your Visual Studio Online account is
unrecoverable. Both of those are extremely low risk, and very likely
lower than the risks you'd have running TFS on-premises, in your own
data centre, unless of course, your infrastructure and staff are
better than Microsoft's :-)
I agree with Richard. Visual Studio Online is not going anywhere :) You can also use tools like OpsHub, TaskTop, and Kovair to setup a two-way synchronization or use the TFS Integration Platform to do the same thing if you really wanted an option. If you are using Git repositories, you can clone the repository into other locations to maintain multiple copies. All of those options take effort.
I posted the same answer to this stackoverflow question.
We developed our own VSO backup tool. We scheduled it as a scheduled task and it runs once a night. It then
just clones all our repositories to disk.
Taken from this blog:
We use the VSO Rest API to query our VSO account and get all the data
we need. Since in VSO you can only have one Team Project Collection,
we retrieve all the team projects of the default collection. Each of
these team projects can have multiple repositories that need to be
backed up. A folder is created for each team project and saved to a
location on disk that can be configured in the app.config. When the
team project folder is created, the task loops over each repository in
the team project and creates folders for each repository.
You can also fork it on GitHub here

Code-review entire project, not just shelveset, using TFS code-review

TFS 2012 includes excellent support for code-reviewing changesets. However, we have some legacy projects that we want to code review. Once the quality has been brought up to spec, we will start using changeset reviews - however the code changes infrequently, so it's not practical to just review the changesets and improve quality through natural code-churn.
Is it possible to code-review a file or project in it's entirety, rather than just a changeset?
In TFS 2012 this is not an option. If the project is small enough there is a trick, you can right-click the folder in source control, do "checkout..." and then request the review. That allows you to review up to 4000 files at a time.
In TFS 2013 a new feature was added, Lightweight Code Commenting in Web Access. This allows you to annotate the code directly from the code tab in Web Access.
There are 3rd party code review options available on Codeplex, I haven't used them in quite a while, but they might add something more to your liking:
Team review
Team Code Review Workflow
Malevich

What should we use as source control with TFS in Visual Studio(TFS source control plugin or VisualSVN )?

We are planning to use Team Foundation Server, but we need to decide whether to use the Visual Studio Team Foundation Server source control plugin or the VisualSVN source control plugin inside Visual Studio.
If you plan to use TFS, go for the TFS Source Control, feature-wise it's as good as SVN if not better (history is managed the same way, branches too, perfs are better).
But where you get benefits in the TFS Source Control compared with SVN is in the integration with Work Item and the rest of TFS.
When you work on a given Task Work Item you can associate your check-ins (then changeset) with the Task, and it's very powerful because you'll have a more project based view than code view.
The Source Control of TFS is the lowest layer of the ALM Solution, you can avoid using it, but you'll lose a lot of things (integration with Work Item, Continuous Integration, Reports, etc.)
If you are planning to use Team Foundation Server, then use visual studio team foundation server source control plugin.

ALM, VSTS 2010 : is it possible to create custom checkin policy in local machines?

I am trying to enfore a custom checkin policy to my dev team.
the customr policy is aimed # alerting the dev with a list of checkpoints before the checkins happen.
I am not the administrator of TFS 2010.
Is it possible to install custom policies for each developer machine?
This is totally possible, BUT you need the help of your TFS administrator once. He needs to activate the custom policy on your TFS project centrally, otherwise your check-in actions do not trigger the custom policy to be activated.
Create you custom policy.
Upload it to your projects version control tree according to: http://blogs.msdn.com/b/youhana/archive/2011/03/27/distributing-custom-check-in-policies-amp-wit-controls-using-team-members.aspx
Distribute TFS Powertools in your team to distribute and sync your custom policies.
Ask the TFS administrator to activate your custom policy.
Is this an acceptable scenario for your situation?

Resources