Get Custom Check-in Policy in the Add List

Hello,

I have a custom check-in policy that requires that the comment is filled in.  I added the assembly to the HKLM\Software\Microsoft\VisualStudio\8.0\TeamFoundation\SourceControl\Checkin Policies registry key.  The key is the assembly name, the value is the full path to the assembly.

But the policy does not show up in the list   How can you get your custom check-in policies to show up in the list

For reference, I used the folllowing post for guidance.  I derived from PolicyBase to create the custom code policy class.
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=139563&SiteID=1 

Thanks!
Cindy


Answer this question

Get Custom Check-in Policy in the Add List

  • BiGAlex

    I appear to have the same issue with the Policy Checkin using PolicyBase.

    I was able to compile my assembly, add it to the registry and it shows up when I choose "Add", but then it never ends up in the actual lists of check-in policies.

    Buck, any luck on figuring out what is going on

    Thanks,
    ~slee


  • bighead

    The work item check-in policy that ships with TFS derives from PolicyBase, so that should have worked just fine.  I'm not sure what prevented yours from loading.

    Buck



  • Sarah Parra - MSFT

    • assuming CanEdit, make sure you have Edit return true - if it always returns false, it'll never save the policy
    • make sure to add it to the particular team project
    • make sure it's enabled

    During testing you may just want to have your Evaluate always return at least one error so you know it's being used. Then, if you're not getting at least some error (if there's a loading problem it'll be an internal error), then you know the team project isn't configured with that checkin policy.



  • Harald Kjersen

    I had a horrible time trying to get the check in policy to show up.  What I finally ended up doing was downloading the October release of the Visual Studion 2005 SDK (http://msdn.microsoft.com/vstudio/extend/default.aspx) and modifying the sample custom check-in policy in that SDK.  So I ended up not deriving from PolicyBase, but from IPolicyDefinition and IPolicyEvaluation instead.  Not sure if that was the ultimate issue or not.

    Here is the registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\TeamFoundation\SourceControl\Checkin Policies

    Add a string value to that key:
    Name: name of the assembly, minus the extension.
    Value: The full path to the assembly, including the extension.

    For example; assembly location: C:\CustomPolicies\My.Namespace.CheckInPolicies.dll

    Example key:
    Name: My.Namespace.CheckInPolicies
    Value: C:\CustomPolicies\My.Namespace.CheckInPolicies.dll


  • citizenjimi

    I don't doubt that PolicyBase works ... I was convinced that I had it working.  I created a very simple check in policy that requires that the user enter in comments.  Everything was fine, but I couldn't get it in the list.

    Ultimately I became frustrated with the list thing, so I compiled the sample check in policy, registered it and it showed up in the list.  So I just took that policy and massaged it into the comments policy.

    I wouldn't mind updating the code to use PolicyBase ... seems much simpler. :)


  • Bayer

    Thanks for the follow up.  I'm glad you finally got it working.  Deriving from PolicyBase should have worked, so we'll check into it.

    Buck



  • Qubic808

    Were you ever able to get this to work   What are the actual key and value used in registry

    Buck



  • Get Custom Check-in Policy in the Add List