Показаны сообщения с ярлыком TFS API. Показать все сообщения
Показаны сообщения с ярлыком TFS API. Показать все сообщения

пятница, 17 февраля 2012 г.

TFS recover TFS Collection DB command

TFSConfig Recover /ConfigurationDB:tfsserver\SQLR2;Tfs_Configuration /CollectionDB:tfsserver\SQLR2;Tfs_collectionName

пятница, 20 января 2012 г.

TFS Service Development: Set ChangedBy field for workitem


Case: You are developing service, that should change some WorkItems in Team Foundation Server.
Service should set field ChangedBy properly.


var collection1 = new TfsTeamProjectCollection(new Uri("http://tfs:8080/tfs/collection"));
collection1.EnsureAuthenticated();

var ims = collection1.GetService<IIdentityManagementService>();
var id = ims.ReadIdentity(IdentitySearchFactor.AccountName, "domain\\username"MembershipQuery.None, ReadIdentityOptions.None);

var collection = new TfsTeamProjectCollection(new Uri("http://tfs:8080/tfs/collection"), id.Descriptor);

-- OR --

WorkItem wi;
...
// Change Work Item
...
// Set ChangedBy Field
wi[CoreField.ChangedBy] = userName;
wi.Save();

среда, 24 августа 2011 г.

How to convert TFS folder to branch programmatically by TFS API (Convert to Branch operation in VS2010))


How to convert TFS folder to branch programmatically by TFS API (Convert to Branch operation in VS2010))

First you need create instance of VersionControlServer object. Then use CreateBranchObject method. serverTrunkPath="C:\myWorkspace\trunk" - target folder you want to make branch.

versionControlServer.CreateBranchObject(new BranchProperties(new ItemIdentifier(serverTrunkPath)));

четверг, 3 февраля 2011 г.

TFS: To make merge from stablility or build Label to trunk

For example, you have code labelled "Stable_1" in development branch and you need to merge the code to trunk.

string SourceLabel = "Stable_1"
GetStatus status = workspace.Merge
    (DevelopmentPath, TrunkPath,
    null, VersionSpec.ParseSingleSpec( "L" + SourceLabel, null ),
    LockLevel.CheckOut, RecursionType.Full, MergeOptions.None);