0

I want to write an ReSharper extension that performs an action after every build, so I guess I need to first know when a build has completed and the also find out about if the build was successful or not

Any tips about how to do that?

(I'm completely new to making extensions) thanks in advance

niklasda
  • 116
  • 6

1 Answers1

0

You can just use Visual Studio's own events for that. Get an instance of the DTE object and subscribe to the OnBuildBegin and OnBuildDone events.

You can see this in action in the Clippy ReSharper extension. It subscribes to the events, and gets the DTE instance from the call to Shell.Instance.GetComponent<DTE>().

Note that how you reference the DTE type is very important - it's a COM reference, and shouldn't be referenced as a Embedded PIA intro type, or ReSharper's component model container will see it as a different type to the DTE instance it knows about. Instead, simply reference it as a non-PIA type:

<Reference Include="envdte, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
  <SpecificVersion>False</SpecificVersion>
  <EmbedInteropTypes>False</EmbedInteropTypes>
  <HintPath>..\..\lib\envdte.dll</HintPath>
</Reference>
citizenmatt
  • 18,085
  • 5
  • 55
  • 60