According to the MSDN the method GetTeamProjectCollection(RegisteredProjectCollection projectCollection, ICredentialsProvider fallbackCredentialsProvider
of the TfsTeamProjectCollectionFactory
class is now deprecated:
"Note: This API is now obsolete."
[ObsoleteAttribute("This method has been deprecated and will be removed in a future release. See GetTeamProjectCollection(RegisteredProjectCollection) instead.", false)]
The advice is to use the overload that only takes the RegisteredProjectCollection
, but what should we use from now on if we want a fallback mechanism for credentials?
Thanks
Class factory for TfsTeamProjectCollection objects. The TfsTeamProjectCollectionFactory type exposes the following members. Gets the TfsTeamProjectCollection instance that is associated with the server at the specified URI. Gets the TfsTeamProjectCollection instance that is associated with the specified RegisteredProjectCollection instance.
It caches TfsTeamProjectCollection objects without regard to credentials. Cached objects are indexed only by server uniform resource identifier (URI). Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Use the Project Creation Wizard in Team Explorer to create a project or the Team Project deletion tool to delete one. That error message isn’t helpful when you already have a team project with this name and only the TFVC project folder is missing. To fix this, you’ll need to use the TFS client OM.
TF.exe makes it easy to destroy a TFVC team project folder, but if you do it’s not as easy to recreate it. You can destroy all TFVC data in a team project by running tf.exe destroy $/<projectName> Then if you try to navigate TFVC in a web browser, you’ll see an error like this:
You need to use the new TfsTeamProjectCollection constructor along with this TfsClientCredentials constructor which allows interactive prompts for authentication.
// Use default windows credentials, and if they fail, AllowInteractive=true
var tfsCreds = new TfsClientCredentials(new WindowsCredential(), true);
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("http://yourserver:8080/tfs/DefaultCollection"),
tfsCreds);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With