问题
I've been trying to use the Forbidden Patterns part of the TFS 2010 Power Tools and I'm just not understanding something - I simply cannot get anything to change as I try to use this! I'm using the version that was released recently (I believe April 23, 2010), so it's not an old version.
First off, yes, I know it's regex based, so let's clear that doubt...
I have tried to block the following scenarios:
1)
I have modified all of my T4 EF templates to generate files named EntityName.gen.cs
. I then attempted to prevent TFS from wanting to check those files in. I used the regular expression \.gen\.cs\z
and it didn't change a single thing! I even tried it without the \z
and nadda!
2)
I don't want app.config and web.config files to be checked-in by default because we have these things stored into app.config.base and web.config.base files that our build scripts use to generate our per-environment app.config and web.config files. As such, I tried the following regexes and again, nothing worked! web\.config\z
, app\.config\z
, web\.release\.config\z
and web\.debug\.config\z
.
What is it that I am screwing up with this?
回答1:
Here's a set of expressions we use that work. We have the December 2011 Team Foundation Power Tools installed, which is where the Forbidden Patterns Policy feature comes from, not from a base TFS 2010 install.
.*/[Bb]in/.*
.*/[Pp]ackages/.*
.*/[Oo]bj/.*
.*/_[Rr]eshar[Pp]er./.*
\.((?i)suo$)
\.((?i)user$)
thumbs\.db
I also found another site that has a good write-up with example patterns.
回答2:
After playing around for a while I found a working solution for excluding *.config files (derived from the following blog link text)
^(.+\.config$)
Please don't ask me why it's the way it is, I don't really get it myself, especially the part with '$)' (')$' does not work!)
来源:https://stackoverflow.com/questions/2741412/forbidden-patterns-check-in-policy-in-tfs-2010