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

  • Home
  • SEARCH
  • 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 8562909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:50:11+00:00 2026-06-11T16:50:11+00:00

Microsoft.TeamFoundation.VersionControl.Client.Workspace.PendAdd For some reason, whenever I call the PendAdd method from the TFS API,

  • 0

Microsoft.TeamFoundation.VersionControl.Client.Workspace.PendAdd

For some reason, whenever I call the PendAdd method from the TFS API, it executes with no exceptions yet fails to mark any files as added in my workspace. However, Calling PendEdit consistently works as expected. I’ve verified that the account used both has permission to add within TFS and has full control Windows permissions on the files in question.

Any ideas?

My code (for debugging, I’m attempting four variations on input to the PendAdd method):

public bool AddFile( string filePath, out string status, bool isRecursive = false )
{
    Workspace workspace = GetWorkspace( out status );
    if( workspace == null )
    {
        return false;
    }

    workspace.PendAdd( filePath, isRecursive );

    status = "Success";
    return true;
}

public bool CheckOutFile( string filePath, out string status )
{
    Workspace workspace = GetWorkspace( out status );
    if( workspace == null )
    {
        return false;
    }

    workspace.PendEdit( filePath );

    status = "Success";
    return true;
}
...
string status;

// $/Solution/.../foo.cs (non-recursive)
if( TFS.AddFile("$/Solution" + Regex.Split(target, "Solution")[1].Replace('\\', '/'), out status) == false )
{
    throw new Exception( "TFS Add failed: " + status );
}

// $/Solution/.../ (recursive)
if( TFS.AddFile("$/Solution" + Regex.Split(target.Substring(0, target.LastIndexOf('\\')), "Solution")[1].Replace('\\', '/'), out status, true) == false )
{
    throw new Exception( "TFS Add failed: " + status );
}

// Calls PendEdit with C:\TFS\Solution\...\foo.cs; this works
if( TFS.CheckOutFile(target, out status) == false )
{
    throw new Exception( "TFS Checkout failed: " + status );
}

// C:\TFS\Solution\...\foo.cs (non-recursive)
if( TFS.AddFile(target, out status) == false )
{
    throw new Exception( "TFS Add failed: " + status );
}

// C:\TFS\Solution\...\ (recursive)
if( TFS.AddFile(target.Substring(0, target.LastIndexOf('\\')), out status, true) == false )
{
    throw new Exception( "TFS Add failed: " + status );
}
...
private Workspace GetWorkspace( out string status )
{
    Workspace[] workspaces = _versionControlServer.QueryWorkspaces( null, _versionControlServer.AuthorizedUser, Environment.MachineName );

    if( workspaces.Length != 1 )
    {
        status  = "You must have exactly 1 local workspace to promote code.";
        return null;
    }
    else
    {
        status  = "You have exactly 1 local workspace.";
    }

    return workspaces[0];
}
  • 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. Editorial Team
    Editorial Team
    2026-06-11T16:50:12+00:00Added an answer on June 11, 2026 at 4:50 pm

    Well, this is odd, but I made a change to allow multiple users to add or edit files through this controller (rather than one hardcoded user) and create a new workspace for each user when necessary, and now everything’s working as originally intended. This is pretty odd, considering that nothing that should have been related to this behaviour was modified in any significant way.

    I’m not fully convinced that this isn’t a bug / that I hadn’t previously been hitting some edge case in the code, but as long as my project works (which it does as of now) I’m not really concerned either way.

    Relevant Microsoft Connect thread (in case this does turn out to be a problem with TFS and is later resolved).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a tool that references Microsoft.TeamFoundation.VersionControl.Client.dll, which is a 32-bit DLL. When
In the context of the TFS version control SDK (Microsoft.TeamFoundation.VersionControl), what exactly is deletionID?
I'm trying to connect to TFS 2010 through the .Net Microsoft.TeamFoundation.Client.TeamFoundationServer class (in this
I've been playing about with the WorkItem objects from the Microsoft.TeamFoundation schemas in C#,
I ran into a situation where two machines both had microsoft.teamfoundation.testmanagement.client.dll in the GAC
Error that pops up even before anything else loads: Package Load Failure Package 'Microsoft.TeamFoundation.Client.ServicesHostPackage,
Does anyone know the difference between System::Collections::ObjectModel::ReadOnlyDictionary and Microsoft::TeamFoundation::Client::ReadOnlyDictionary ?
Microsoft provides a method as part of WinHTTP which allows a user to determine
Microsoft .NET Framework Client Profile Offline Installer - 255.6 MB. Shouldn't it be 27MB
Microsoft J++ does not have a Double.parseDouble() method. How do I do this?

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.