Search code examples
jetbrains-iderider

JetBrains Rider run Pre/Post Build events when building in Rider


A project I'm working on has a csproj file with Pre/Post build events that only run when its being built in Visual Studio. It looks like this:

<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true' ">
    <!-- Pre build stuff -->
</Target>

Is there an equivalent condition for when a project is being built inside Rider, something like '$(BuildingInsideRider)'?


Solution

  • I reached out to Jetbrains support with the same question, and they told me the property name is '$(BuildingByReSharper)'. It's also worth noting that it's only useable in Rider 2021.1.3 and newer.