Wednesday, September 13, 2017

Check-in İşeminde Work Item State Değerinin Otomatik Resolved Olması


Check-in işleminde work item'a ait state bilgisi otomatik olarak resolved oluyorsa;

VS2015 ->Tools-> Options -> Source Control ->  Visual Studio Team  Foundation Server -> Resolve associated work items on check-in 'deki tik kalıdırılır.

yada

Registery da HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\TeamFoundation\SourceControl\Behavior\ResolveAsDefaultCheckinAction -> ResolveAsDefaultCheckinAction değeri false yapılır.

NOT: Makinanın  restart edilmesi gerekebilir.




Friday, September 8, 2017

TFS 2015 Build ile Çağrılan PowerShell'e Parametre Değeri Göndermek



    TFS Build ile çağrılan PowerShell'e  parametre göndermek için yapılması gereken işlemler aşağıdaki gibidir.

    Build Tanımları

             1.   Build tanımına PowerShell adımı eklenir.



             2. Repository tabına gidilip 'Mappings' ayarları yapılır


             3. Variables tabına gidilip, scripte kullanılan parametreler tanımlanır.


            4. Build tabında Arguments alanına scritpe gönderilecek olan  parametreler yazılır.



        Powershell'de  parametre tanımlaması


        param(
   
                              [Parameter(Mandatory=$true)]
                              [string]$UserName,
   
                              [Parameter(Mandatory=$true)]
                              [string]$Password
             )

TFS Rest Api ile Test Case Oluşturmak



    Yaptığım iş gereği var olan bir Test Case değerini okuyup tekrar oluşturmam gerekti.
 
     $response =  Invoke-RestMethod -Uri "http://tfsaddress/collectionname/_apis/wit/workItems/1"

     if($response.fields.'System.WorkItemType' -eq "Test Case")
     {
     
       $areaPath        = $response.fields.'System.AreaPath'.Replace("\","\\")
       $teamProject     = $response.fields.'System.TeamProject'
       $iterationPath   = $currentIteration
       $workItemType    = $response.fields.'System.WorkItemType'
       $title           = $response.fields.'System.Title'
       $priority        = $response.fields.'Microsoft.VSTS.Common.Priority'
       $automationStatus= $response.fields.'Microsoft.VSTS.TCM.AutomationStatus'
       $steps           = $response.fields.'Microsoft.VSTS.TCM.Steps'.Replace('"',"'")
       $assignToUser    = $assignToUser.Replace("\","\\")

       $json = @"
       [
        {
             "op": "add",
             "path": "/fields/System.Title",
             "value":"$title"
        },

        {
             "op": "add",
             "path": "/fields/System.TeamProject",
             "value":"$teamProject"
        },
       
        {
            "op" : "add",
            "path": "/fields/System.AreaPath",
            "value": "$areaPath"
        },
       
        {
            "op" : "add",
            "path": "/fields/System.WorkItemType",
            "value": "$workItemType"
        },
         
        {
           "op" : "add",
           "path": "/fields/System.IterationPath",
           "value": "$iterationPath"
        },  
     
        {
           "op":"add",
           "path":"/fields/System.State",
           "value":"Design"
        },

        {
           "op" : "add",
           "path": "/fields/Microsoft.VSTS.Common.Priority",
           "value": "$priority"
        },

        {
            "op" : "add",
            "path": "/fields/Microsoft.VSTS.TCM.AutomationStatus",
            "value": "$automationStatus"
        },

        {
           "op" : "add",
           "path": "/fields/Microsoft.VSTS.TCM.Steps",
           "value": "$steps"

        },

        {
           "op" : "add",
           "path": "/fields/System.AssignedTo",
           "value": "$assignToUser"

        },

        ]"
"@

}

   
$result = Invoke-RestMethod  -Uri "http://tfsaddress/collectionname/_apis/wit/workitems/`$Test%20Case?api-version=1.0"
                             -Credential $mycreds
                             -Method Patch
                             -Body  $json
                             -ContentType "application/json-patch+json"




Wednesday, August 16, 2017

PowerShell Invoke-RestMethod Türkçe Karakter Problemi



PowerShell üzerinden rest method invoke etmeye çalışırken, post ettiğim parametre değerlerinde Türkçe karakterler problemi yaşandı. Gönderdiğim json parametresini  UTF8 encoding ile gönderince problem düzeldi.


$secpasswd = ConvertTo-SecureString "mypassword" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("myuser", $secpasswd)

$jsonParam = "{""name"":""Özlem"",""surname"":""Arslan""}"

Invoke-RestMethod  -Uri $createUri -Credential $mycreds -Method "Post" -Body  ([System.Text.Encoding]::UTF8.GetBytes($jsonParam))  -ContentType "application/json"

Wednesday, August 2, 2017

Check In Yaparken Work Item Zorunlu Hale Getirmek


 
 
Check In işlemlerinde 'Related Work Items' alanın zorunlu hale gelmesini aşağıdaki kod ile   sağlayabilirsiniz.


  


 
   var ev = notificationEventArgs as CheckinNotification;

   CheckinNotificationWorkItemInfo[] workItemInfos = ev.NotificationInfo.WorkItemInfo;

   if ((workItemInfos == null || workItemInfos.Length == 0))
   {
         statusMessage = "Work Item ID numarası yazınız ";

         return EventNotificationStatus.ActionDenied;
    }

Friday, February 24, 2017

There is no source code available for the current location



Projede debug yapmaya çalışırken uygulama  'There is no source code available for the current location'  şeklinde hata verdi. 

Projeyi kontrol ettiğimizde belirtilen dizinde istediğimiz .cs mevcuttu. VS'de   Project-> Properties-> Common Properties -> Debug Source Files tabına geldiğimiz zaman "Do not look for these soruce files"  listesinde debug etmeye çalıştığımız .cs ye ait bilgi bulunmaktaydı. Bu bilgiyi sildiğimiz zaman yaşadığımız problem giderilmiş  oldu.










Monday, February 13, 2017

typings install unhandled promise rejection (rejection id: 1): Unable to connect to "https://api.typings.org" ..



     > typings install
       / Resolved "undefined"
       (node:6452) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id:    1):  PopsicleError: Unable to connect to https://api.typings.org/entries/dt/node/tags/6.0.0..
 
      Yukardaki gibi bir hata alıyorsanız, proxy ayarlarınız ile ilgili bir sorun yaşıyor olmanız muhtemeldir.
     
      Install komutunu 'typings --proxy "http://...:8080/" install' şeklinde çalıştırdığım zaman  kurulum başarılı  bir şekilde gerçekleşti.
 

Ürdün

  Çok hızlı bir şekilde karar alıp, harekete geçtiğim bir gezi oldu Ürdün. Nitekim bir pazar günü arkadaşım Firuze ile konuşup, pazartesi...