Nickz
Nickz

Reputation: 1880

Exclude from project, source control issue

I'm using team foundation server 2010 @ work and home. I want to exclude some element from the project build but still have them exist in Team Foundation Server 2010 source control. How do I achieve this? Exclude From Project will delete the item.

Upvotes: 11

Views: 4206

Answers (4)

BanditoBunny
BanditoBunny

Reputation: 3896

Editing a project file and removing the references to the files you want to exclude would be the easiest solution.

Another solution would be to remove files from the project via UI, but only checkin changes in the project file and undo the delete operations.

In the future you can add files directly to the TFS folder in Team Explorer.

May I ask: why would you want to do that? As I commonly have a problem of files which are not bound to any project and have to be getted manually.

Upvotes: 3

Only You
Only You

Reputation: 2072

I think these steps should help you do what you are looking for.

To exclude an item from a deployment project:

In Solution Explorer, select the file you want to exclude.

On the Solution Explorer toolbar, select Properties.

In the Properties window, set the Exclude property to True.

And this page explains the actions for project files supported by VS 2010:

http://msdn.microsoft.com/en-us/library/0ebzhwsk.aspx

--- Edit ---

At work I tried 'Exclude From Project' in one of the files of a project we have in VS 2010, which is bound to a TFS 2010 server, and this action did not delete the item from TFS; the Source Control Explorer window shows the red delete mark next to the item, and the 'Pending Change' column says delete, but item is there. Right click the item in the Source Control Explorer window, one of the commands in the context menu that pops-up is 'Check In Pending changes' and another one is 'Shelve Pending changes'. Shelving enables you to set aside the pending changes.

The file is still in the local hard drive. If I do 'Include In Project' the item comes back to normal.

Upvotes: 1

sacredfaith
sacredfaith

Reputation: 870

I work in a TFS environment, and if it were me? I'd just change the name of the file (instead of excluding it from the project), and check that in instead. Since your project is expecting that particular filename...it won't find it. We use this when we're developing prototypes or holding on to antiquated code for documentation purposes. Sorry VS is eating your stuff!

Kind Regards,

-sf

Upvotes: 1

Antonio Bakula
Antonio Bakula

Reputation: 20693

Same problem here, only way to do this is manually edit project file :(

Please vote that this bug is important to fix

https://connect.microsoft.com/VisualStudio/feedback/details/573582/vs-2010-exclude-from-project-deleting-files-from-source-control

Workaround posted on Connect:

Open the csproj file in notepad and find the files that need to be excluded and remove or comment the compile element for that file, and any related designer and resx files.

Upvotes: 10

Related Questions