I'm trying to have ReSharper's cleanup code automatically run during TFS Checkin and before commit on all files in Pending Changes.
Ideally, when you right click on the solution / project and select Source Control > Check in all the files in the Pending Changes should run cleanup code. I've got the custom checkin policy to work to some extent, works fine if you select a single file to check in but when you select the solution or project, it tries to run cleanup code on the entire solution / project and not just the files selected in TFS Pending Changes.
I'm running VS 2013 with R# 8.2. My policy evaluate code:
public override PolicyFailure Evaluate()
if (PendingCheckin.Policies.EvaluationState == PolicyEvaluationState.Unevaluated)
DTE2 dte = PendingCheckin.GetService(typeof (DTE)) as DTE2;
foreach (EnvDTE.Document doc in dte.Documents)
return new PolicyFailure;
Is there a way to run ExecuteCommand on only 1 file / document? Or I should be using a different command?
It seems like PendingCheckin.GetService(typeof (DTE)) only gets files that are open in the Visual Studio editor not all the files that are in the Pending Changes list.
I can get a list of PendingChange through PendingCheckin.PendingChanges.CheckedPendingChanges but I don't know how to execute a command on PendingChange. Any advice would be appricated. I may be going about this the wrong way.