Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
5.4k 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...