How to undelete releases of a release definition?

One of our customer have reported as he has deleted few releases of a given release definition accidentally and wanted to know a way to bulk un-delete those releases. The undelete can be done within 15 days of the soft delete and after that releases are permanently deleted. It can be un-deleted either using Powershell…


Cancelling all InProgress/Queued environment between two days

Recently one of our internal customer ‘OneDrive’ reported as they have many InProgress/Queued environments. And they wanted to cancel all such environments and asked us to help. So I have written a program which would take account url, project name, definition id, NumberOfDaysBefore and NumberOfDaysAfter and Cancel the environment. How to do:- GetReleases2Async() takes parameter…


Compute changeset difference between two releases using API’s

Below are the steps which can be followed to compute changeset difference between two releases for TFVC project  =========================================================================================== Step1: Get details of the primary build artifact for the current release  using build API. Store ‘sourceVersion’ say as ‘currentReleaseBuildVersion’ https://{account}{project}/_apis/build/builds/{buildId} e.g. Step2: Get details of the primary build artifact for the older release. Store ‘sourceVersion’ say as ‘baseReleaseBuildVersion’…


Utilities methods to use ReleaseManagement REST API’s

Refer post to know as which nuget package is required to be installed. How to add secret variable in release definition? public static ReleaseDefinition AddSecretVariableInReleaseDefinition(ReleaseHttpClient rmClient, string projectName, ReleaseDefinition definition) { var secretVariableKey = “secretVariableKey”; var secretVariableValue = new ConfigurationVariableValue { Value = “secretVariableValue”, IsSecret = true }; definition.Variables.Add(secretVariableKey, secretVariableValue); var updatedDefinition = rmClient.UpdateReleaseDefinitionAsync(definition, projectName).Result;…


Release is failing with ‘Object reference not set to an instance of an object’

In case your release is failing with ‘Object reference not set to an instance of an object’ post upgrade of your TFS with below snapshot just after creating the release In case you have moved your TFS server from one machine to other and ran PrepareClone, ChangeServerID, RemapDb following command Workaround: – Create a…


CryptographicException while adding TFS connection to ReleaseManagement Update-4 client

One of our customer reported below error :- Issue:- While adding a TFS connection, user were getting CryptographicException Message: Bad Data.: \r\n\r\n   at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)   at System.Security.Cryptography.RSACryptoServiceProvider.DecryptKey(SafeKeyHandle pKeyContext, Byte[] pbEncryptedKey, Int32 cbEncryptedKey, Boolean fOAEP, ObjectHandleOnStack ohRetDecryptedKey)   at System.Security.Cryptography.RSACryptoServiceProvider.Decrypt(Byte[] rgb, Boolean fOAEP)   at Microsoft.TeamFoundation.Release.Data.Helpers.CryptoHelper.GetDecryptedValue(String str, String containerName)   at Microsoft.TeamFoundation.Release.Data.Helpers.CryptoHelper.DecryptString(String str, String cryptoContainerName, String key, Encryption encryption)  …


Writing a ReleaseManagement extension for cloning an existing release definition

Code shared :- How to make Changes:- Step1: Clone the repository using the link Step2: Open a command prompt and go till folder ‘rd-export-import-clone-TFS2015U2’ Step3: Run ‘bower install’ [ pre-requsite for running ‘bower’ can be referred] which will download 1.95.2 version of VSS.SDK.js Step4: Make your changes Step5:  Run ‘tfx extension create’…


Using Clone, Export and Import an existing release definition for TFS2015 Update2

Summary:- A ReleaseManagement extension for Cloning, Importing and Exporting an existing release definition is released in the VisualStudio marketplace at . But as it uses some improvement done post release of TFS2015U2 hence it doesn’t allow to be installed for TFS2015U2. I have tried to write another extension with slight variation of experience (explained below)….


Using ReleaseHttpClient for interacting with ReleaseManagement service

ReleaseHttpClient is public as nuget package : GitHub samples: Fetching release definitions using given credential :- Step1: Create one ‘Windows Console Application’ using Visual studio 2015 Step2: Goto Tools –>NuGet Package Manager –> Manage NuGet Packages for Solutions –> Browse (make sure Package source: Step3: Search and Install following package to your solution  Microsoft.VisualStudio.Services.Release.Client…


Using PAT token in ReleaseManagement REST API’s

Generating PAT Token:- Step1: Generate PAT token by visiting your profile and selecting the right ReleaseManagement scope as per API need ( see ‘Available scopes’ section ) Step2: Copy the token generated after clicking ‘Create Token’ as shown in image above   Code which uses the generated PAT token above :- public static async…