0

I've carefully used this answer to build a .vsix for Visual Studio 2017 Professional such that a certain project with check-in policies is registered and used whenever I check-in some code to TFS.

After the .vsix installation when I open Team Explorer and the Pending Changes page an error appears:

enter image description here

I've opened privateregistry.bin hive with regedit and I couldn't find a similar key with the one which I added for Visual Studio 2010.

.pkgdef file:

[$RootKey$\TeamFoundation\SourceControl\Checkin Policies]
"KeywordExpansionPolicy"="$PackageFolder$\KeywordExpansionPolicy.dll"

.vsixmanifest file:

<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
    <Identity Id="CheckInPolicies.761071af-97b8-4262-a392-35ff1ee54968" Version="1.0" Language="en-US" Publisher="publisher" />
    <DisplayName>CheckInPolicies</DisplayName>
    <Description xml:space="preserve">Policies: keyword expansion.</Description>
</Metadata>
<Installation>
    <InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.Pro" />
    <InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.IntegratedShell" />
</Installation>
<Dependencies>
</Dependencies>
<Assets>
    <Asset Type="Microsoft.VisualStudio.Assembly" d:Source="Project" d:ProjectName="KeywordExpansionPolicy" Path="|KeywordExpansionPolicy|" AssemblyName="|KeywordExpansionPolicy;AssemblyName|" />
    <Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="File" Path="KeywordExpansion.pkgdef" />
</Assets>
<Prerequisites>
    <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,16.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>
</PackageManifest>

What could possibly go wrong?

tomab
  • 2,061
  • 5
  • 27
  • 38

4 Answers4

1

Open Tools > Entension And Updates check if the extension is enabled. If not enabled then enable it and restart VS. Check if the Policy warning appear.

Other wise follow the answer by Tomab and correct the extension dependencies for Visual Studio version.

Varun Sood
  • 11
  • 2
0

Since you had two versions of Visual Studio installed, VS 2010 and VS2017.

If you created a custom check-in policy using VS 2010 and trying to make it work with VS 2017. First make sure you have rebuild in VS 2017. Then take care of below notice:

Visual Studio 2017 : Check-in policies in Visual Studio 2017 must be set through Team Explorer, tf.exe, or through registry keys declared in the pkgdef of a Visual Studio extension. Policies only apply a single installation of Visual Studio 2017 on your computer. If you have multiple installations of Visual Studio 2017, you'll need to set the check-in policy on each installation.

Source Link: https://www.visualstudio.com/en-us/docs/tfvc/add-check-policies

In your case, suggest you also try rebuilding it in a machine that only has VS 2017 installed. This will narrow down the issue if related to your multiple VS installed Environment. The checkin policy project/solution maybe still referencing to VS 2010 libraries.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • I've tried to build the solution within a VM which has only VS2017 Professional installed but to no avail. – tomab Nov 21 '17 at 11:37
0

I haven't found a complete solution, but I did this as a workaround to resolve the issue:

VS 2017 only - Run

sn -Vr *,*

in a VS command line session.

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Viyan
  • 1
  • 3
0

Finally, by raising an incident to MSDN Support team, the error was solved. A simple one, of course :)

The project which contains the actual logic of the check-in policy must have two references to VS libraries:

References to VS libraries

Those references were there from the very first moment of creating the project but their version was the problem. They should have had the version, or the path, for VS 2017, the targeting VS version for which the extension is meant to be created, not an older VS. Click on Microsoft.TeamFoundation.Client, Alt+Enterfor Properties window and there is the version (Path property):

Version of above references

tomab
  • 2,061
  • 5
  • 27
  • 38
  • Can you elaborate on this please? Which are the 2 dlls? What versions should they be and where will I find the correct versions of these? I mean are you saying that there are different versions of Microsoft.TeamFoundation.Client for VS 2015, 2017, 2019 etc ? – Dr T Oct 10 '19 at 00:16
  • Yes. There are different versions, depending on your target. As far as I remember those are installed when you add the VS extension for creating TFS clients. – tomab Oct 11 '19 at 13:14