Using existing Check-in policies with TFS 2012
A few days ago a forum user of the MSDN forums posted a question on how to use the existing Check-in policies from Visual Studio 2010 (or below) with the Visual Studio 11 beta. I remembered having bookmarked a similar question on how to use the 2008 Check-in policies in 2010.
The process to use an older version is rather straightforward, but it requires some digging.
First, open the check-in policy you want to use in the newer version of Visual Studio with Reflector.NET or a similar tool and expand the "References" item to see which dependencies the assembly has that come from Visual Studio:
Write down all the full names of the assemblies starting with Microsoft.TeamFoundation and Microsoft.VisualStudio.
Now open the devenv.exe.config in your visual studio folder using your favorite XML editor (make sure you run the editor as an administrator, otherwise you won't be able to save the file). Also make sure Visual Studio 11 beta isn't running.
For each dependency you've found, add a redirection policy if it doesn't already exist. I added the following policies to get the Team Foundation Server Power Tools Check-in policies to work with Visual Studio 11.
<!-- Added for Checkin policies -->
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.VersionControl.Client" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.Client" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.WorkItemTracking.Client" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.VersionControl.Common.Integration" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.VersionControl.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.Common.Library" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.WorkItemTracking.Proxy" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.Build.Controls" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.TeamFoundation.VersionControl.Controls" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="8.0.0.0-99.9.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
Visual Studio loads the list of available check-in policies from the registry. So you'll need to add your policies there as well. The following .reg file will add the policies from the Policy Pack:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\TeamFoundation\SourceControl\Checkin Policies]
"Microsoft.TeamFoundation.PowerTools.CheckinPolicies.WorkItemQueryPolicy"="C:\\Program Files (x86)\\Microsoft Team Foundation Server 2010 Power Tools\\Check-in Policy Pack\\Microsoft.TeamFoundation.PowerTools.CheckinPolicies.WorkItemQueryPolicy.dll"
"Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ChangesetComments"="C:\\Program Files (x86)\\Microsoft Team Foundation Server 2010 Power Tools\\Check-in Policy Pack\\Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ChangesetComments.dll"
"Microsoft.TeamFoundation.PowerTools.CheckinPolicies.CustomPathPolicy"="C:\\Program Files (x86)\\Microsoft Team Foundation Server 2010 Power Tools\\Check-in Policy Pack\\Microsoft.TeamFoundation.PowerTools.CheckinPolicies.CustomPathPolicy.dll"
"Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ForbiddenPatternsPolicy"="C:\\Program Files (x86)\\Microsoft Team Foundation Server 2010 Power Tools\\Check-in Policy Pack\\Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ForbiddenPatternsPolicy.dll"
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\TeamFoundation\SourceControl\Checkin Policies]
"Microsoft.TeamFoundation.PowerTools.CheckinPolicies.WorkItemQueryPolicy"="C:\\Program Files (x86)\\Microsoft Team Foundation Server 2010 Power Tools\\Check-in Policy Pack\\Microsoft.TeamFoundation.PowerTools.CheckinPolicies.WorkItemQueryPolicy.dll"
"Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ChangesetComments"="C:\\Program Files (x86)\\Microsoft Team Foundation Server 2010 Power Tools\\Check-in Policy Pack\\Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ChangesetComments.dll"
"Microsoft.TeamFoundation.PowerTools.CheckinPolicies.CustomPathPolicy"="C:\\Program Files (x86)\\Microsoft Team Foundation Server 2010 Power Tools\\Check-in Policy Pack\\Microsoft.TeamFoundation.PowerTools.CheckinPolicies.CustomPathPolicy.dll"
"Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ForbiddenPatternsPolicy"="C:\\Program Files (x86)\\Microsoft Team Foundation Server 2010 Power Tools\\Check-in Policy Pack\\Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ForbiddenPatternsPolicy.dll"