Open sandboxFocusImprove this doc

PS0077: Invalid Expression in a Date Attribute of a Task

Severity Error
Reported by PostSharp
Message Task "<Task>": invalid expression "<Expression>" for attribute "<Attribute>".

Cause

A configuration file, such as postsharp.config or a .psproj file, can configure the tasks of the PostSharp compiler with a Tasks section: each element names a task, and its attributes set the properties of the task. An attribute value can contain expressions such as {$PropertyName}, which PostSharp evaluates before it converts the value to the type of the property.

PostSharp reports PS0077 when it cannot evaluate the value, <Expression>, of the attribute <Attribute> of the task <Task>, and the property is a date. The error stops the build. PostSharp reports another message just before PS0077 that says why the expression cannot be evaluated, for example an unknown property or an unbalanced brace.

No task of PostSharp or of its packages has a date property, so only the task of a third-party plug-in can report this message, and no example can show it.

Resolution

  • Read the message that PostSharp reports just before PS0077: it names the problem in the expression.
  • Correct the expression in the attribute of the task element. Make sure that every property that the expression uses is defined, for example in a Property element of the configuration file or in the PostSharpProperties MSBuild property, and that the braces are balanced.
  • When you do not need to set the attribute, remove it.
  • Check the documentation of the plug-in that defines the task for the expected value of the attribute.

See Also

Other Resources

Configuring Projects Using postsharp.config
Configuration File Schema Reference
Well-Known PostSharp Properties