VS 2017入住政策:政策大会未注册

时间:2017-11-16 11:38:51

标签: c# visual-studio tfs visual-studio-2017

我已经小心翼翼地使用this answer为Visual Studio 2017 Professional构建.vsix,以便每当我向TFS签入一些代码时,都会注册并使用带有签入策略的特定项目。< / p>

在我打开Team Explorer和Pending Changes页面时安装.vsix后出现错误:

enter image description here

我已经使用regedit打开了privateregistry.bin hive,但我找不到与我为Visual Studio 2010添加的密钥相似的密钥。

.pkgdef文件:

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

.vsixmanifest文件:

<?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>

可能出现什么问题?

4 个答案:

答案 0 :(得分:1)

打开工具>扩展和更新 检查扩展名是否启用。如果未启用,则启用它并重新启动VS。检查是否显示策略警告。

否则,明智的做法是遵循Tomab的答案,并更正Visual Studio版本的扩展依赖性。

答案 1 :(得分:0)

由于您安装了两个版本的Visual Studio,VS 2010和VS2017。

如果您使用VS 2010创建了自定义签到策略并尝试使其与VS 2017一起使用。首先确保您在VS 2017中重建。然后请注意以下注意事项:

  

Visual Studio 2017:必须通过团队资源管理器,tf.exe或Visual Studio扩展的 registry keys declared in the pkgdef 设置Visual Studio 2017中的签入策略。政策   仅在您的应用程序上应用Visual Studio 2017的单个安装   电脑。如果您有多个Visual Studio 2017安装,   您需要在每次安装时设置签入策略。

     

来源链接:https://www.visualstudio.com/en-us/docs/tfvc/add-check-policies

在您的情况下,建议您尝试在仅安装了 VS 2017 的计算机上重建它。如果与您的多个VS安装环境相关,这将缩小问题范围。签入策略项目/解决方案可能仍然引用VS 2010库。

答案 2 :(得分:0)

我还没有找到完整的解决方案,但我这样做是解决问题的一种解决方法:

仅限VS 2017 - 运行

sn -Vr *,*

在VS命令行会话中。

答案 3 :(得分:0)

最后,通过向MSDN支持团队提出事件,错误得以解决。一个简单的,当然:))

包含签入策略实际逻辑的项目必须有两个对VS库的引用:

References to VS libraries

这些引用是从创建项目的第一个时刻开始的,但它们的版本是问题所在。他们应该拥有VS 2017的版本或路径,VS 2017是要为其创建扩展的目标VS版本,而不是旧的VS.单击属性窗口中的Microsoft.TeamFoundation.Client Alt + Enter ,其中包含版本(Path属性):

Version of above references

相关问题