Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 176981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:58:25+00:00 2026-05-11T13:58:25+00:00

Summary: How can I determine TFS source control configuration for a local folder. Explanation:

  • 0

Summary: How can I determine TFS source control configuration for a local folder.

Explanation:

In our Software Factory I am creating CruiseControl.NET configuration files automatically based on the local folder where code from a source control system is living. I currently only want to support Subversion and TFS. Determining that Subversion is used as source control system, and determining the location of the repository is easy using the svn.exe info command, like shown in the PowerShell code below. But how can I do this when TFS is used?

One of the ‘problems’ is that the currently logged-in user does NOT have access to the TFS server. We can’t use integrated security because the dev machines are not domain-joined.

The closest I got was tf dir , I have to enter credentials in a popup box. Couldn’t find command-line arguments to specify user and password. tf properties looks promising as well, but you must be authenticated to execute call. Subversion can provide info without authentication.

My current code in PowerShell with working code for SubVersion, the TFS code is missing;-) Note that for the actual creation of the CruiseCOntrol.NET block we have a configured source control username and password available in global variables.

 # #    #        #           https://svn.mycompany.nl/svn/Acme.Intranet #        #    # #   If under source control return a CruiseControl.NET source control configuration block in #   the following format: #    #       https://svn.mycompany.nl/svn/Acme.Intranet #       c:\project\Acme.Intranet.Build\WorkingDirectory\$configuration #       acmebuild #       acmepassword #            #.Parameter configuration #   Either 'Debug' or 'Release' # .Returns #   A string with the configuration block, or $null if not under Subversion source control. ##> function GetSubversionSourceControlBlock {     param     (         $configuration     )      $svn_exe = Join-Path -Path $productfolder -ChildPath 'tools\DotNet2\svn-win32-1.5.2\svn.exe'     $svnProductInfo = [xml](& $svn_exe info `'$productFolder`' --xml)     $trunkUrl = $svnProductInfo.info.entry.url     if ($trunkUrl -ne $null)     { @'                      $trunkUrl             $buildfolder\WorkingDirectory\$configuration             $MastConfigurationGlobal_SourceControlUserName             $MastConfigurationGlobal_SourceControlPassword                  '@         Verbose 'Under Subversion source control. Trunk Url: $trunkUrl'     }     else     {         Verbose 'Not under Subversion source control'         $null     } }     # #       tfs.mycompany.nl #       $/Acme.Intranet #       c:\project\Acme.Intranet.Build\WorkingDirectory\$configuration #       acmebuild #       acmepassword #            #.Parameter configuration #   Either 'Debug' or 'Release' # .Returns #   A string with the configuration block, or $null if not under Tfs source control. ##> function GetTfsSourceControlBlock {     param     (         $configuration     )      $null }    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:58:26+00:00Added an answer on May 11, 2026 at 1:58 pm

    The story continues:

    If you execute the tf command from a cmd prompt, everything goes as described in the previous answer. If you do it from a PowerShell command prompt you get the following:

     PS C:\> & tf.exe workfold c:\projects\Macaw.SolutionsFactory\FactoryIdeTools\trunk /login:macaw\serge,Trasimeno5 TF10125: The path 'c:\projects\Macaw.SolutionsFactory\FactoryIdeTools\trunk' must start with $/ 

    It gives an error!

    I have tried everything, but to no avail. I even tried it through the TFS object model, but that got really complex. To get the workspace for a local folder you need a name of the tfs server first. It is probably possible to iterate all currently mapped workspaces and iterate through the servers defined there (that is probably what tf.exe does) to test if the local folder belongs to that workspace.

    I finally came up with the following solution:

    I create a simple batch file ExecTfWorkprodCommand.bat wit the following code:

     @echo off rem This is a kind of strange batch file, needed because execution of this command in PowerShell gives an error. rem This script retrieves TFS sourcecontrol information about a local folder using the following command: rem tf workfold  /login:domain\user,password rem %1 is path to the tf.exe executable rem %2 is the local path rem %3 is the domain\user [optional, integrated security used if ommited] rem %4 is the password    [optional, if %3 is not specified] rem Output is in format: rem =============================================================================== rem Workspace: Macaw.SolutionsFactory@VS-D-SVDOMOSS-1 (Serge) rem Server   : tfs.macaw.nl rem $/Macaw.SolutionsFactory/FactoryIdeTools/trunk: C:\Projects\Macaw.SolutionsFactory\FactoryIdeTools\trunk  if [%3]==[] goto integratedsecurity %1 workfold '%2' /login:%3,%4 goto end  :integratedsecurity %1 workfold '%2'  :end 

    And I call this batch script from PowerShell. From the result I want to parse:

    • Tfs server name
    • Folder on server

    Example code on how to solve this:

     $tfsProductInfo = & 'ExecTfWorkprodCommand.bat 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe' 'c:\projects\Macaw.SolutionsFactory\FactoryIdeTools\trunk' domain\user password if ($tfsProductInfo -eq $null) {     Write-Output 'Can't determine Tfs source control information on local folder' } else {     $tfsserver = [Regex]::Split($tfsProductInfo[2], ': ')[1].Trim()     $serverpath = [Regex]::Split($tfsProductInfo[3], ': ')[0].Trim()     $localpath = [Regex]::Split($tfsProductInfo[3], ': ')[1].Trim()     Write-Output 'Server     : $tfsserver'     Write-Output 'Server path: $serverpath'     Write-Output 'Local path : $localpath' } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 100k
  • Answers 100k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer On my system, about 8K was buffered before I got… May 11, 2026 at 7:59 pm
  • Editorial Team
    Editorial Team added an answer You'll quickly find out that this isn't allowed due to… May 11, 2026 at 7:59 pm
  • Editorial Team
    Editorial Team added an answer WM_COPYDATA would work fine, but I think it's better to… May 11, 2026 at 7:59 pm

Related Questions

In ruby, if I do require foo, is there a way to subsequently determine
Okay, I get it. Data in PostgreSQL is case-sensitive. And I know I can
How can I document a member inline in .Net? Let me explain. Most tools
How can I count how many previous FootNoteReference nodes there are in an xml

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.