Skip step in personal builds in TeamCity

There's an environmental variable thats exposed in teamcity that can tell you if this is a personal build BUILD_IS_PERSONAL :

See http://confluence.jetbrains.com/display/TCD7/Predefined+Build+Parameters

E.g. using the msbuild runner (you just need to supply the nuget path)

<Project DefaultTargets="Pack" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Target Name="Pack" Condition="$(BUILD_IS_PERSONAL)!='True'">
    <Message Text="Personal: $(BUILD_IS_PERSONAL)"/>
    <Exec Command="$(NUGETPATH)\nuget pack $(NugetProject)"/>
  </Target>
</Project>

Alternatively, you could halt the condition of build steps using an extra build step. thereby making them conditional:

Add an extra build step that uses the powershell-

if (([environment]::GetEnvironmentVariable("BUILD_IS_PERSONAL","Process")) -eq "True")
{ 
  throw
}

On each build step there is the option:Execute step If you choose the option "If all previous build successfully" then the step will be passed If you choose: "Even if some of the previous build steps failed" it will execute.