A while ago I developed a custom TFS check-in policy that was working fine with Visual Studio 2015.
Now I installed Visual Studio 2017 and wanted to register the check-in policy assembly the same way as I did with VS2015 before. But this does not work. How can I register custom check-in policy assemblies with VS2017?
For VS2015, I had these registry keys:
[HKEY_LOCAL_MACHINESOFTWAREWOW6432NodeMicrosoftVisualStudio14.0TeamFoundationSourceControlCheckin Policies]
"MyCheckInPolicy"="C:\Program Files\My\MyCheckInPolicy.dll"
and
[HKEY_CURRENT_USERSOFTWAREMicrosoftVisualStudio14.0_ConfigTeamFoundationSourceControlCheckin Policies]
"MyCheckInPolicy"="C:\Program Files\My\MyCheckInPolicy.dll"
and accordingly I added those keys for VS2017 (15.0
):
[HKEY_LOCAL_MACHINESOFTWAREWOW6432NodeMicrosoftVisualStudio15.0TeamFoundationSourceControlCheckin Policies]
"MyCheckInPolicy"="C:\Program Files\My\MyCheckInPolicy.dll"
[HKEY_CURRENT_USERSOFTWAREMicrosoftVisualStudio15.0_ConfigTeamFoundationSourceControlCheckin Policies]
"MyCheckInPolicy"="C:\Program Files\My\MyCheckInPolicy.dll"
But unfortunately this does not work:
- If I open the Team Project SourceControl settings, go to the "Check-in Policy" tab and try to Add... a policy,
MyCheckInPolicy
does not appear1
- If I open the team project that uses this check-in policy already and do the above, I got an error message telling me that the assembly (
mycheckinpolicy
) "has not been registered".
Of course I restarted the IDE after the registry change, but even rebooting my machine did not help.
The information I found so far seems to suggest that check-in policies now have to be part of an extension (vsix), which I don't want to believe.
I guess that the problem comes from some references that cannot be resolved when the assembly is loaded into the IDE.
The MyCheckInPolicy
project references the Microsoft.TeamFoundation.VersionControl.Client.dll
v14.0 from the VS2015 folder C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDECommonExtensionsMicrosoftTeamFoundationTeam Explorer
.
I tried to reference the respective dll from the VS2017 folders, but then the assembly does not work in both IDEs.
I also tried to use the Nuget package "Microsoft.TeamFoundation.VersionControl.All" v12.0.30723.2 instead and deployed all files from the output directory (which seem to contain all assemblies of the package) to the location mentioned in the registry keys. This had the same result: the policy cannot be loaded in neither VS2015 nor VS2017.
We are using TFS 12.0.30723.0.
1So it seems VS2017 doesn't even try to load the assembly and does not care about the registry keys?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…