[error]The term ‘Release.ReleaseNumber’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Root Cause

Variables of Build and Release steps are evaluated in run time. So you will get this type of errors when you try to reference variables with other (pre-defined and custom) variables. The variable value won’t be populated thus the PS scripts won’t recognize them.

Solution/Work Around

Only use static value with Variables. Hope MS will improve this in future releases (later than TFS 2015 Update 2).