Expression cannot appear inside a quoted attribute value

Expression cannot appear inside a quoted attribute value. Try removing quotes.

An embedded expression in an attribute value for an XML literal is contained within quotation marks.

Error ID: BC31155

To correct this error

  • Remove the delimiting quotation marks from the attribute value. The following is an example:

    ' Generates an error.
    Dim elem = <outer attr="<%= value %>" />
    
    ' Does not generate an error.
    Dim elem = <outer attr=<%= value %> />
    

See Also

Concepts

Embedded Expressions in XML

Other Resources

XML Literals

XML in Visual Basic