André Maldonado
André Maldonado

Reputation: 123

Check-in policy error with VS 2012 and TFS 2010 - CheckForWarningsPolicy

We were using Team Foudation Server 2010 with Visual Studio 2010 for every project we made in our company. We created some post build events, some check-in policies and everything was working correctly.

Recently we moved to Visual Studio Professional 2012 (Version 11.0.51106.06 Update 1) and now, everytime we try to check-in some code, we get this error:

Internal error in Check for Compilation Warnings and Errors Policy. Error loading the Check for Compilation Warnings and Errors Policy policy (The policy assembly 'CheckForWarningsPolicy, Version=2.1.0.0, Culture=neutral, PublicKeyToken=342882479c9e5e25' is not registered.). Installation instructions: To install this policy, please read ReadMe.txt.

Error loading the Check for Compilation Warnings and Errors Policy policy (The policy assembly 'CheckForWarningsPolicy, Version=2.1.0.0, Culture=neutral, PublicKeyToken=342882479c9e5e25' is not registered.). Installation instructions: To install this policy, please read ReadMe.txt.

ReadMe.txt that is cited in the end of the error is not reachable, there is no link or indication where the file is.

I've searched for this answer in google and here, but without any luck. Probably I'm making the wrong search.

I read some questions like:

But none of them worked for me. What can I do to solve this error?

Thank's

Upvotes: 5

Views: 4842

Answers (3)

Kakash1hatake
Kakash1hatake

Reputation: 148

you need to recompile the policy under 2012 studio because the TFS API in it is different - assembly version is 11.0 and in 2010 is 10.0

Upvotes: 0

André Maldonado
André Maldonado

Reputation: 123

I "solved" the error and I'll post what I did so anyone who's facing the same problem can learn from my experience.

To create this check-in policy in Visual Studio 2010 we used a custom policy developed by Jeff Bramwell (link to MSDN profile). This policy, apparently, it's not being maintained by him as you can see in the policy page in MSDN. I asked a question in the page and sent him a tweet, now I'll wait for his answer.

Testing this policy in Visual Studio 2010 I checked that it was not working, so, I just removed it from the Project in Project > Settings > Source Control > Check-in Policy.

If I need something more detailed, I can add a Code Analysis check-in policy as described in the Stack Overflow question about Prevent check-in if code analysis warning exists. With this approach I can even set a custom rule.

Hope this will help someone with the same problem.

Upvotes: 2

jessehouwing
jessehouwing

Reputation: 114511

You will have to install your 2010 checkin policies in 2012. The simplest way is to register the existing assemblies in the Visual Studio 2012 registry hyve on every machine that uses the checkin policy. And then see whether they now also work in Visual Studio 2012. You can try to use a binding redirection to resolve any versioning issues. The process for setting up the binding redirections is explained in this blog post.

Should you be using API's that have changes with Visual Studio 2012, then you might have to compile a new version of the Checkin Policy and register that in the 2012 registry hyve of each machine using the checkin policy.

The blog post I already referenced, also explains which registry hyve you'll need to register your policies under.

Upvotes: 0

Related Questions