Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying Custom Policy on TFS2010 using VSIX and PKGDEF

Tags:

tfs

vsix

I'm having a hell of a time trying to get a custom policy to install on TFS2010 using VSIX.

I have the policy up and running and working fine on my development PC, I have written a value to the registry manually, and the policy is enforced.

The trouble is setting up a VSIX project and deployment to our other development machines.

I followed the instructions in:

http://blogs.msdn.com/b/jimlamb/archive/2010/03/31/how-to-implement-package-and-deploy-custom-check-in-policy-for-tfs-2010.aspx

The preferred method appears to be to use the new VSIX project type in VS 2010, I add a VSIX project to my solution, but the instructions in the blog entry are very vague about what to do next. My understanding is that the PKGDEF file means you do not have write a value to the registry when deploying, and the content of the PKGDEF file is rolled into the config when you start Visual Studio. That's fine, but how do you build up the VSIX package?

I tried adding the custom policy project to the VSIX project as a VS Package type, but when I build I get the error: The target "PkgdefProjectOutputGroup" does not exist in the project.

I have tried adding just the dll, the pkgdef file as a custom content type, etc, but nothing works.

I have changed the PKGDEF file in the blog to match my own project.

When I install the VSIX package on a development machine, I can see the add-in in the Extensions Manager in Visual Studio, but when I check the custom policies in TFS, I get the "is not registered" error.

I really need a step-by-step to setting up a VSIX project to deploy a custom policy, can anyone help?

like image 591
user343587 Avatar asked Oct 14 '10 00:10

user343587


2 Answers

The blog post definitely has a missing step. I think what the author intended was that you add the pkgdef file to the VSIX project (via the vsixmanifest editor) as Content of type VS Package. Then, add a project reference to the checkin policy project from your VSIX project (which will cause the checkin policy DLL to be added to your VSIX).

As a side note....when you pick "VS Package" as the content type and then point to a project...it needs to be a proper VS Package project (not just a vanilla C#/VB class library).

like image 108
Aaron Marten Avatar answered Oct 18 '22 14:10

Aaron Marten


The problem is the assembly name "NArrange.CheckinPolicy.dll" does not match the name in the Policies.pkgdef. To correct this make sure that your Policies.pkgdef looks like this:

[$RootKey$\TeamFoundation\SourceControl\Checkin Policies]
"TeamFoundation.Samples.CheckinPolicies"="$PackageFolder$\NArrange.CheckinPolicy.dll"

Additionally I would avoid further confusion by changing the "Product Name" in source.extension.vsixmanifest to NArrange.CheckinPolicy. This way the assembly will match the product name in VS Extensions.

like image 38
Roman Dvoskin Avatar answered Oct 18 '22 14:10

Roman Dvoskin