Extended Variable Syntax Intellisense Errors

operations

(Michael C) #1

When using Octopus Extended Variable Syntax in my app.config file, Visual Studio 2017 Intellisense recognizes this as invalid xml format and shows multiple errors. This is undesirable noise.
Example:
<SomeConfigElement attribute=“normal” #{if this} that=“something” #{/if} />

Is there a way to tell VS this syntax is ok? or is there a way to better shape the syntax so it doesn’t parse as invalid?


(Lawrence Wilson) #3

Hi,
Thanks for getting in touch! After trying a few things in Visual Studio 2017 to stop these validation errors, I came up empty handed and I was not able to suppress these Intellisense errors unfortunately.

So we came up with one potential work-around which may fit here and I thought I would mention it here just in case. Please note this is an example only and it might need a bit of extra work to get the desired results.

For example, you could abstract the variable substitution syntax out of the XML File and into Octopus as a variable. To do this, you could have a new Octopus Variable called SomeConfigElement which has a value of:

#{if Condition } <SomeConfigElement attribute="normal" that="something" />#{/if}

Then in your XML File, you could have something along the lines of:

<?xml version="1.0" encoding="utf-8"?>
<properties>
  #{SomeConfigElement}
</properties>

I’m sorry I wasn’t able to be more helpful here, I’m interested to know if such a work-around would work for you though.

Kind regards,
Lawrence.