Tuesday, November 21, 2017

TFS - ReParenting a Branch.

Here is how you can do Reparenting for TFS branch. 
Scenario: Before 
  • Development
    • Release 1
      • Release 2
Scenario: After
  • Development
    • Release 1
    • Release 2

Now you want to bring Release 2 under development, then you need to do re parenting. 


  1. Create Release 2 branch from Release  
  2. Get the latest version of Release 2 locally. 
  3. Get the latest version of Development branch locally. 
  4. Add location of tf command (generally “C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE”) to your PATH.
  5. Open command prompt and go to the working folder of Release 2. If you don’t do this then you may get error related to workspace while running commands mentioned below.
  6. Now you need to perform a baseless merge from the development branch to Release 2. Make sure it is recursive. (why recursive ? because if  you don’t do it recursive then while merging your changes from Release2 to development, and if you do it from the folder level, it would show you Release 1 as the parent. In that case, you should always start your merge by right clicking on the “Release 2” level. Which is annoying. So go for recursive. )
  7. Here is the command.
  8. Tf merge /baseless /recursive “$/Development” “$/Development/Release2”
  9. This command may take a while depending on the size of your source code.
  10. Once done, it will show you resolve conflict window. In my case, I don’t want changes from development branch to be merged into Release 2, so I choose Keep destination files. And resolve the conflict for all. 
  11. Once done, you will have a big chunk of files ready for check in in Release 2 branch. 
  12. Go ahead and check in. 
  13. Once check in is done, right click on Release 2 and then select ReParenting (under branch and merging menu)
  14. You should be able to see Development branch there. 
  15. Select it. And hit ok. 
  16. All done. Release 2 has now Development as its parent. 
Thanks

Wednesday, November 8, 2017

Admin Consent for an App

Please go to the website 
and login the application by your directory global administrator account one time. The permission will delegate to the end user.

More information – Admin Consent


Thursday, May 11, 2017

Exponential backoff for retry mechanism

For retry mechanism, rather than retrying on a specific interval of time, it is advisable to handle it with exponential backoff. This is important in the world of Azure, Pass or any where you are communicating with external resources, as there are more chances of transient errors compared to local resources. 

All communicating with the external resources should have retry mechanism. There are some nuget packages available to handle the transient errors but following articles shows a nice and neat implementation of handling them with exponential backoff. And give us control to change the code as per our requirements.


Tuesday, March 14, 2017

Viewing Parent of the Task/Bug in TFS Query

You may often require to view the Parent of any Task/Bug in TFS query result. This can be done easily by changing the type of Query to "Work items and direct links" and then setting the filter options as highlighted below.

Of course, it can be modified to different options as required.




Wednesday, March 1, 2017

IIS Keep prompting for the password while using SSL with Windows Authentication

Disable the loopback check (less-recommended method)

The second method is to disable the loopback check by setting the DisableLoopbackCheck registry key.

To set the DisableLoopbackCheck registry key, follow these steps:
  1. Set the DisableStrictNameChecking registry entry to 1. For more information about how to do this, click the following article number to view the article in the Microsoft Knowledge Base:

    281308 Connecting to SMB share on a Windows 2000-based computer or a Windows Server 2003-based computer may not work with an alias name
  2. Click Start, click Run, type regedit, and then click OK.
  3. In Registry Editor, locate and then click the following registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
  4. Right-click Lsa, point to New, and then click DWORD Value.
  5. Type DisableLoopbackCheck, and then press ENTER.
  6. Right-click DisableLoopbackCheck, and then click Modify.
  7. In the Value data box, type 1, and then click OK.
  8. Quit Registry Editor, and then restart your computer.

Tuesday, February 21, 2017

How to find the public key token of any dll.

Run following command in PowerShell. 

([system.reflection.assembly]::loadfile("G:\Devlopment\Samples\Azure\WebAPIServiceAuth\TodoListService\bin\System.IdentityModel.Tokens.Jwt.dll")).FullName

Trust IIS Certificate

To configure your computer to trust the IIS Express SSL certificate, begin by opening a Windows Powershell command window as Administrator.
Query your personal certificate store to find the thumbprint of the certificate for CN=localhost:
PS C:\windows\system32> dir Cert:\LocalMachine\My


    Directory: Microsoft.PowerShell.Security\Certificate::LocalMachine\My


Thumbprint                                Subject
----------                                -------
C24798908DA71693C1053F42A462327543B38042  CN=localhost
Next, add the certificate to the Trusted Root store:
PS C:\windows\system32> $cert = (get-item cert:\LocalMachine\My\C24798908DA71693C1053F42A462327543B38042)
PS C:\windows\system32> $store = (get-item cert:\Localmachine\Root)
PS C:\windows\system32> $store.Open("ReadWrite")
PS C:\windows\system32> $store.Add($cert)
PS C:\windows\system32> $store.Close()
You can verify the certificate is in the Trusted Root store by running this command:
PS C:\windows\system32> dir Cert:\LocalMachine\Root

Ref: 
https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-native-headless/