Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not working with vs 2012 if checkin policy exists #258

Closed
Jiyuu opened this issue Dec 9, 2012 · 20 comments
Closed

not working with vs 2012 if checkin policy exists #258

Jiyuu opened this issue Dec 9, 2012 · 20 comments

Comments

@Jiyuu
Copy link

Jiyuu commented Dec 9, 2012

everything seems to work fine except for the checkin process which fails for the following reason

[ERROR] Policy: Internal error in Changeset Comments Policy. Error loading the Changeset Comments Policy policy (The pol
icy assembly 'Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ChangesetComments, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' is not registered.). Installation instructions: To install this policy, follow the inst
ructions in CheckForComments.cs.

seem to have a ref to vs2010 somewhere which I couldn't find..

@spraints
Copy link
Member

spraints commented Dec 9, 2012

This is usually caused by version mismatches. For example, if the checkin policy installed is for VS2010, but git-tfs finds VS2012, then the 2012 client lib won't be able to load the checkin policy.

Which versions of VS / Team Explorer do you have installed? Which versions of TFS power tools do you have installed? Which one do you use to access TFS? Which version of TFS is git-tfs using (git tfs --version or git tfs info)?

@kgybels
Copy link
Contributor

kgybels commented Dec 9, 2012

@Jiyuu I had the same problem after installing VS2012. Tell git-tfs to use 2010 client by setting environment variable GIT_TFS_VERSION to 2010.

@Jiyuu
Copy link
Author

Jiyuu commented Dec 9, 2012

I forgot to mention but if I set --force then the commit works, but when looking at the changeset it shows the error mentioned above as a policy issue..

@spraints this is the output of git tfs info

C:\test\Main>git tfs info

git version 1.8.0.msysgit.0

git-tfs version 0.16.1.0 (TFS client library 11.0.0.0 (MS)) (32-bit)
 C:\tools\gittfs\git-tfs.exe

remote tfs id: 'default' http://XXXXXXX:8080/tfs/ $/TP/Main
               refs/remotes/tfs/default -  3aa246ae3db1dac9bfd214657632545fcd33cc
4f @ 10931

the version im using is the version I took last night from here on git hub and built. I only compiled and used the V11 version though as I don't actually have VS2010 on this pc and it failed compilation.

the TFS server is indeed TFS2010 , and as mentioned the VS version I have is 2012.
I did not install any power tools(as I didn't see any such guideline in the instructions.. if I should just tell me what I should install).

using visual studio 2012 though I have no issues committing to the tfs server so it sounds strange to be related to this..

when I use the "checkintool" command it loads the form ok but simply shows the same issue which I quoted above

@kgybels
what environment variable are you referring to? if the windows environment variables then I tried your suggestion but nothing changed..

sorry if I misunderstood..

@kgybels
Copy link
Contributor

kgybels commented Dec 9, 2012

@Jiyuu Sorry my bad, it is GIT_TFS_CLIENT, not GIT_TFS_VERSION.

@pmiossec
Copy link
Member

We are a lot to have this problem. Shouldn't we add the solution in the wiki? Create a page "common problems"?

@Jiyuu
Copy link
Author

Jiyuu commented Dec 10, 2012

@kgybels do I need to restart something after setting that env var?
if not then still not working.. I get the same error

@kgybels
Copy link
Contributor

kgybels commented Dec 10, 2012

@Jiyuu Yes, after setting the environment variable in windows, you need to restart your git command prompt. If it is set correctly, then git tfs info should show the TFS client library version as 10.0.0.0.

@Jiyuu
Copy link
Author

Jiyuu commented Dec 11, 2012

@kgybels now I get the following error

C:>git tfs info
Unable to load TFS version specified in GIT_TFS_CLIENT (2010)!
Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=10.0.0
.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies
. The located assembly's manifest definition does not match the assembly referen
ce. (Exception from HRESULT: 0x80131040)

I don't seem to have that dll..
what do I need to install to get it?
or does it only come with vs2010?

@asantopietro
Copy link

IIRC at a minimum you need to install Team Explorer 2010.

Cheers,
Tony
On Dec 10, 2012 7:50 PM, "Dror Levy" notifications@github.com wrote:

@kgybels https://github.com/kgybels now I get the following error

C:>git tfs info
Unable to load TFS version specified in GIT_TFS_CLIENT (2010)!
Could not load file or assembly 'Microsoft.TeamFoundation.Client,
Version=10.0.0
.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
dependencies
. The located assembly's manifest definition does not match the assembly
referen
ce. (Exception from HRESULT: 0x80131040)

I don't seem to have that dll..
what do I need to install to get it?
or does it only come with vs2010?


Reply to this email directly or view it on GitHubhttps://github.com//issues/258#issuecomment-11226265.

@kgybels
Copy link
Contributor

kgybels commented Dec 11, 2012

@Jiyuu I had another look at this and here is what I found:

The Changeset Comments Policy that is causing the problem used to be provided by the TFS 2010 Power Tools, implemented as CheckForCommentsPolicy.CheckForComments in the Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ChangesetComments assembly [1]. This policy, however, is now provided directly with VS2012 in the Microsoft.TeamFoundation.VersionControl.Controls assembly [2][3][4].

I also found out that these policy plugins are registered at:
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\TeamFoundation\SourceControl\Checkin Policies]

However, for Microsoft.TeamFoundation.VersionControl.Controls, it is set to an empty path, VS must have some other means of loading the correct assembly. Thankfully, you can change that registry key to the full path of the assembly and it will then work with git-tfs! Of course, I also did a quick test to see if it doesn't break VS.

[1] C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\Check-in Policy Pack\Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ChangesetComments.dll
[2] C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.VersionControl.Controls.dll
[3] C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.VersionControl.Controls.dll
[4] I don't know why there are 2 versions, I tested the workaround by setting the registry key to [2]

@Jiyuu
Copy link
Author

Jiyuu commented Dec 18, 2012

so just to clarify in case this happenes to someone else, as when i read the responses i was not 100% sure about what to do.

in order for "GIT_TFS_CLIENT" environmental variable to function i had to install team explorer 2010.
doing so still gave the same error i mentioned before, both for the checkintool(which was now indeed the 2010 version) and for the command line tool.

after that what i did was to set the value of the "Microsoft.TeamFoundation.VersionControl.Controls" in the [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\TeamFoundation\SourceControl\Checkin Policies] registry to
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.VersionControl.Controls.dll"

after doing that both the checkintool(for 2010, and for 2012) and the command line tool worked properly.

so from the look of things it would seem like the only thing really needed was the registry edit, the rest are not required.
i have no idea if this -should- be done by git-tfs but i can definitely say that it will save a lot of headaches for people if this was handled by it automatically..

@spraints
Copy link
Member

Sorry about the hassle, but I'm happy to hear that you were able to resolve the problem.

@spraints
Copy link
Member

Now that I'm writing about this in the wiki, I wonder if this is a 32 vs 64-bit thing? @Jiyuu, is your Windows 64-bit? If VS is also running in 64-bit mode, it is going to use a different registry than git-tfs, which always runs in 32-bit mode. Git-tfs is 32-bit (x86) because the VS2008 version of TFS is also x86, and git-tfs still supports that. When we drop support for VS2008, git-tfs should be able to switch to "Any CPU", which should solve this problem. If you want to try it out, the current master version of GitTfs.sln has an "Any CPU" configuration that excludes VS2008. If you have a chance, could you try it out? I'm curious to see if the "Any CPU" build will find the checkin policies without needing the registry information that you manually added.

@Jiyuu
Copy link
Author

Jiyuu commented Dec 20, 2012

my windows is 64 bit, the visual studio instances im running are running as 32bit though, i will try compiling as you suggested( i assume that you want me to undo the registry edit as well) and report the results later..

@spraints
Copy link
Member

Yeah, that's what I'm curious about. If VS is running as 32-bit, then maybe
something else is going on. If you have a chance to check it out, I'd like
to know if the Any CPU build works with the registry edit undone.

On Thu, Dec 20, 2012 at 5:54 PM, Dror Levy notifications@github.com wrote:

my windows is 64 bit, the visual studio instances im running are running
as 32bit though, i will try compiling as you suggested( i assume that you
want me to undo the registry edit as well) and report the results later..


Reply to this email directly or view it on GitHubhttps://github.com//issues/258#issuecomment-11595964.

@flcdrg
Copy link

flcdrg commented Jan 8, 2013

Just to add some more information to this bug. I was contacted by Philip Kelley from the Microsoft TFS team when I experienced a similar problem. It turned out that it is probably caused by a bug in the TFS installer - because the check-in policies are registered with partial names only.

Philip's suggested fix for this is:

Open regedit.exe and navigate to the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\TeamFoundation\SourceControl\Checkin Policies

(I’ve assumed you’re using a 64-bit operating system. If you’re using a 32-bit version of Windows, please omit the “Wow6432Node” path part.)

There you’ll find two values that have no data. They are “Microsoft.TeamFoundation.Build.Controls” and “Microsoft.TeamFoundation.VersionControl.Controls”, respectively.

We’re not going to add data for the values. Instead, we’re going to rename them to strong names instead of partial names. They don’t need file paths because they are in the GAC – the strong name will suffice. Rename them to:

Microsoft.TeamFoundation.Build.Controls, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

and

Microsoft.TeamFoundation.VersionControl.Controls, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

@kgybels
Copy link
Contributor

kgybels commented Jan 14, 2013

@flcdrg I tried it today and using the strong names works too, thanks!

@zidad
Copy link

zidad commented Feb 5, 2013

@flcdrg Thanks!

@holstebroe
Copy link
Contributor

Tried the Registry update hack today. It worked.

@pmiossec
Copy link
Member

That make me think that we have a doc on this problem and never give the link : https://github.com/git-tfs/git-tfs/blob/master/doc/troubleshooting-checkin-policies.md#the-checkin-policies-need-to-be-registered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants