HOW TO remove deleted branch from TFS that still appears in Visual Studio

This is the story, if you don’t have time to read it, scroll down to read directly the solution.

Today I’ve noted that in the list of the TFS branches in my Visual Studio there was a branch that had been deleted by one of my colleagues but it was still appearing in my list.
I’ve tried first to refresh the list, than tried to cancel it but it was creating new changes to check in and this was not exactly what I was expecting…
I tought it was because I had downloaded the content (there was a local folder connected) but nothing again. Used the funciton “Get Latest Version” but it remained still there. “Check In Pending Changes” showed the message that there was nothing pending to check-in.

Right-click on the branch in Visua Studio then select “View History”. On the top of the list you should see the changeset related to the deletion, Right-click on it then select “Get This Version”.

Did my HOW TO help you? Leave a reply.

HOW TO Synchronize a tenant database schema in a NAV Container

In order to work with NAV containers I highly recommend to use NAVContainerHelper PowerShell module.
In the version a new really powerfull function Invoke-ScriptInNavContainer
has been released, it allows you to invoke a PowerShell scriptblock in a NAV container.

Using NAVContainerHelper you do not have to care about loading NAV modules because they are already part of it and loaded, so to return to the title of this post, the script to synchronize database schema is:

$containerName = "scadev"
Invoke-ScriptInNavContainer -containerName $containerName -ScriptBlock {        
    Get-NAVTenant NAV | Sync-NavTenant -Mode Sync -Force 

Invoke-ScriptInNavContainer has two mandatory parameters, the name of the container and the script block. In the script block I’m using two standard PowerShell functions included in the NAV module Microsoft.Dynamics.Nav.Management:

  1. Get-NAVTenant to retrieve the tenant
  2. Sync-NavTenant to synchronizes the database schema

Did my HOW TO help you? Leave a reply.