执行VSPackage命令生成后

时间:2014-01-10 11:04:31

标签: msbuild vspackage

我创建了新的VSPackage。

来自VST文件的代码:

<Buttons>
  <Button guid="guidAlgoPackCmdSet" id="BuildAlgo" priority="0x0100" type="Button">
    <Parent guid="guidAlgoPackCmdSet" id="AlgoPackMenuGroup" />
    <Icon guid="guidImages" id="bmpPic1" />
    <Strings>
      <CommandName>CustomCommondName</CommandName>
      <ButtonText>Build Custom</ButtonText>
    </Strings>
  </Button>

如何在AfterBuild部分中引用此命令?

下一个配置:

<Target Name="AfterBuild">
    <Exec Command="CustomCommondName" />
</Target>

返回9009错误。

1 个答案:

答案 0 :(得分:0)

找到了一个解决方法,它让我更好地为我提供了更多信息。

private void SubscribeToBuildEvents()
{
    var dte = (DTE)GetService(typeof(DTE));
    _buildEvents = dte.Events.BuildEvents; //we have to save the reference in order to keep events firing
    dte.Events.BuildEvents.OnBuildProjConfigDone += BuildEvents_OnBuildProjConfigDone;

}
private void BuildEvents_OnBuildProjConfigDone(string project, string projectConfig, string platform, string solutionConfig, bool success)
{
   //fires for each built project
}