Solved

TFS 2010: Delete project within Team Project (permanently)

Posted on 2010-11-19
10
2,144 Views
Last Modified: 2012-05-10
Hi

How do I delete a project within my Team project, permanently. If dlete the project it will be marked as deleted in source control, but I want to remove it completely.

I don't wan't to delete the hole Team Project, just a project inside my solution.

I found this, dont know if this is the only way?  is there any UI for doing this?

I want to delete the project WindowsFormApplication1.

tf destroy $/[TeamProjectName]/WindowsFormApplication1 /preview /startcleanup /login:[Name],[pass] /collection:http://[server-name}:8080/tfs/DefaultCollection



0
Comment
Question by:AWestEng
  • 6
  • 3
10 Comments
 
LVL 28

Assisted Solution

by:strickdd
strickdd earned 50 total points
ID: 34175666
unfortunately, there is no GUI for doing this. You will have to use the command line for doing this.
0
 
LVL 23

Expert Comment

by:Admin3k
ID: 34178422
when you are ready to run the command , don't forget to drop the /preview parameter, this just simulates the action & does nothing else .
0
 
LVL 1

Author Comment

by:AWestEng
ID: 34179325
is there any C# code for doing the same as ts, I'm writing my own UI to delete stuff from TFS
0
 
LVL 1

Author Comment

by:AWestEng
ID: 34180272
This what I have now.

I have tried to run this code on ProjectCollections that I thought was already completely deleted, but apparently not.  but not according  RegisteredTfsConnections.GetProjectCollections();

But then the method  (teamProjectCollection.EnsureAuthenticated();) throws an exception that I dont have the authorization to connect to this collection

using (TfsTeamProjectCollection teamProjectCollection = new TfsTeamProjectCollection(

                    new Uri(String.Format("{0}/{1}", this.server, projectCollectionName)), 

                    new NetworkCredential(String.Format("{0}\\{1}", this.domianName, this.username), this.password)))

                {

                   

                    teamProjectCollection.EnsureAuthenticated();



                    TeamProjectDeleter projectDeleter = new TeamProjectDeleter(teamProjectCollection, projectCollectionName, true);

                    

                    projectDeleter.StatusEvent += new TeamProjectDeleter.StatusEventHandler(this.StatusUpdate);

                    projectDeleter.ExcludeWss = false;

                    projectDeleter.Delete();

                }

Open in new window

0
 
LVL 23

Expert Comment

by:Admin3k
ID: 34190016
I am not sure why would you want to reinvent the wheel here, Project collections , team projects are deletable from the TFS admin console out of the box , also the tf destroy command does work to permanently delete objects under source control.

However with regards to the error you encounter in your code, Please look into Impersonation samples in the SDK , you will need to impersonate first before TFS identifies you and allows you to perform any source control operations.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:AWestEng
ID: 34190757
But I can only see solutions or project collections, I can't see projects inside a solution uisng the TFS Admin, I can only delete them fron the Solution Explorer, and  if you do that it wont be permanently deleteed. that is when you will use the tf destory command, that is what I'm trying to do here, but with a GUI instead of using cmd
0
 
LVL 1

Author Comment

by:AWestEng
ID: 34190801
and the TFs admin don't take away the sharepoint  sites when deleting a collections,

so I like to have a GUI that will take away.
Site
Collection
dB
and all other things that is connected to a Project collection

and also want to list all the deleted projects, so I can excute a destroy command on them, If I neeed to clean up abit. :)

you know what I mean..
0
 
LVL 1

Author Comment

by:AWestEng
ID: 34190806
but I will check out the SDK., thx man :)
0
 
LVL 23

Accepted Solution

by:
Admin3k earned 450 total points
ID: 34191909
in order to sum your points .

You can completely delete a TEAM project and all its contents (sharepoint site , Source control items, documents, Work items ,etc...) using  two ways with TFS 2010
1- TFSDELETEPROJECT command
2- Team Foundation Administrator Console.

You can also delete a Team project collection in two ways.
1- TFSConfig Collection /delete command
2- Team Foundation Administrator console

The tf destroy command in your initial post does not destroy anything of the above mentioned items except items that are under source control which are usually source code files & folders, it deletes them beyond recovery.

This is why I think this option is not available through the GUI,and can only be done from command line,  in order to regulate using it , and making sure the person who does it is aware of what he is doing since it is irreversible.

Imagine someone accidentally clicking on a destroy command in a visual studio menu for an important project that is used by an entire team, you will only have SQL backups to get to , the level of success in restoring the database depends on how good your backup plan is, and the amount of data added to your TFS databases on a daily basis.

the whole idea of a source control system is to keep History of the code and keep track of changes, so chances are destroying code permanently is not a very popular command.

such commands should be used with care & awareness (Especially in production environments) ,The TFS administrators should know them, but they are not what I would call daily activities.

Finally you can communicate with TFS Programmatically if you need to , Microsoft calls this Extending Team Foundation .
 
Download the Team Foundation Server 2010 SDK & go through the documentation to learn of the APIs you can use , check code samples for the most common activities to familiarize yourself with what you can use this for.

Hope this helps.




0
 
LVL 1

Author Comment

by:AWestEng
ID: 34192269
thx man
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now