Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.9k views
in Technique[技术] by (71.8m points)

continuous integration - How to escape a variable in XL-Release

Our XL-Release pipeline has placeholders with strings destined for an NLog config. NLog configs have syntax that support interpolated values using the same syntax as XL-Release uses for variables: ${variablename}. For example, in NLog ${basedir} equates to the base directory and ${shortdate} gives a current timestamp string.

Unfortunately, XL-Release does a variable lookup on these values, finds nothing and replaces the intended NLog config text with nothing.

Is there a way to escape the NLog values so that XL-Release leaves them alone? Perhaps a backslash?: ${variablename}.

Fo example, our lookup dictionary has an entry like so:

"App": {
  "ProgramName": {
    "ArchiveFilename": "${basedir}/logs/archive/ProgramName-${shortdate}.log",
    "Filename": "${basedir}/logs/ProgramName.log"
  },
etc...

The template looks like this:

<targets>
    <target name="logfile" xsi:type="File" fileName="{{ App.ProgramName.Filename }}"

And, instead of getting this:

<targets>
    <target name="logfile" xsi:type="File" fileName="${basedir}/logs/ProgramName.log"

I get this (XL-Release having dropped ${basedir}):

<targets>
    <target name="logfile" xsi:type="File" fileName="/logs/ProgramName.log"

How can I escape ${basedir} so XL-Release doesn't replace it?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...