tag:help.appveyor.com,2012-11-13:/discussions/problems/256-how-to-interpolate-strings-in-appveyorymlAppVeyor: Discussion 2014-04-30T05:24:22Ztag:help.appveyor.com,2012-11-13:Comment/326893762014-04-24T15:38:08Z2014-04-24T15:38:08ZHow to interpolate strings in appveyor.yml<div><p>Hi Brad,</p>
<p>Interpolation doesn't work in environment variables section, but
you can use $(msbuild_configuration) directly in artifact path.</p>
<ul>
<li>Feodor</li>
</ul></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/326893762014-04-24T16:36:58Z2014-04-24T16:36:58ZHow to interpolate strings in appveyor.yml<div><p>That explains my confusion. Your documentation says to
interpolate<br>
$(configuration) instead of $(msbuild_configuration). With the
wrong var there is no error or warning, the artifact just fails to
build.</p>
<p>You also write 'environment variable' when you mean yaml
string<br>
interpolation which confused me.</p>
<p>Hopefully I'll get it working tomorrow.</p>
<p>However I'm generally impressed and I like it more than
microsofts visual<br>
studio online product.</p>
<p>Thanks for the help</p>
<p>Brad.</p></div>bradphelantag:help.appveyor.com,2012-11-13:Comment/326893762014-04-24T17:05:38Z2014-04-24T17:05:38ZHow to interpolate strings in appveyor.yml<div><p>I'm glad you like the service!</p>
<p>Sure, let me know if you have any questions!</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/326893762014-04-25T05:16:54Z2014-04-25T05:16:54ZHow to interpolate strings in appveyor.yml<div><p>The documentation still says as of this morning</p>
<p># pushing a single file with environment variable in path and
"Deployment name" specified - path: MyProject\bin\$(configuration)
name: myapp</p>
<p>rather than</p>
<p># pushing a single file with environment variable in path and
"Deployment name" specified - path:
MyProject\bin\$(msbuild_configuration) name: myapp</p></div>bradphelantag:help.appveyor.com,2012-11-13:Comment/326893762014-04-25T06:19:16Z2014-04-25T06:19:16ZHow to interpolate strings in appveyor.yml<div><p>But I thought <code>msbuild_configuration</code> is your custom
variable, no?</p>
<p><code>configuration</code> in docs is just an example - you can
replace any valid environment variable.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/326893762014-04-25T06:39:59Z2014-04-25T06:39:59ZHow to interpolate strings in appveyor.yml<div><p>Now you have me confused. I now have in my appveyor.yml</p>
<pre>
<code>#---------------------------------#
# artifacts configuration #
#---------------------------------#
artifacts:
- path: WeinCad.Net\bin\$(msbuild_configuration)\app.publish
name: clickonce</code>
</pre>
<p>and I <strong>do not</strong> define
<strong>msbuild_configuration</strong> anywhere. However my
artifact was correctly built.</p>
<p><a href=
"https://ci.appveyor.com/project/BradPhelan/weincad-net/build/0.0.24/artifacts">
https://ci.appveyor.com/project/BradPhelan/weincad-net/build/0.0.24...</a></p>
<p>I also note more inconsistent string interpolation syntax. Below
you use "{}" to interpolate the build and version whereas in the
artifacts section you use "$()".</p>
<pre>
<code># enable patching of AssemblyInfo.* files
assembly_info:
patch: true
file: AssemblyInfo.*
assembly_version: "2.2.{build}"
assembly_file_version: "{version}"
assembly_informational_version: "{version}"</code>
</pre></div>bradphelantag:help.appveyor.com,2012-11-13:Comment/326893762014-04-25T06:57:38Z2014-04-25T06:57:38ZHow to interpolate strings in appveyor.yml<div><p>Try to output this variable to see its value, something
like:</p>
<pre>
<code>before_build:
- ps: $env:msbuild_configuration</code>
</pre>
<p>That {version} syntax was left for assembly patching only for
compatibility with AppVeyor V1.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/326893762014-04-25T07:11:09Z2014-04-25T07:11:27ZHow to interpolate strings in appveyor.yml<div><p>Sorry for wasting your time. My bad! I had from the begining in
<strong>upper case</strong></p>
<pre>
<code>environment:
MSBUILD_CONFIGURATION: Release</code>
</pre>
<p>Perhapps it would be better if the information</p>
<pre>
<code># build platform, i.e. x86, x64, AnyCPU. This setting is optional.
platform: AnyCPU
# build Configuration, i.e. Debug, Release, etc.
configuration: Release</code>
</pre>
<p>is by default made available as environment variables for custom
build_scripts. If I make my own custom build script do you do
anything with the above settings such as generate a configuration
file that msbuild automagically picks up from the build
directory?</p></div>bradphelantag:help.appveyor.com,2012-11-13:Comment/326893762014-04-25T17:15:13Z2014-04-25T17:15:13ZHow to interpolate strings in appveyor.yml<div><p>Both "platform" and "configuration" are set as environment
variables with the same names, but only for "MSBuild" build mode.
Do you think it makes sense to set them for custom scripts too?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/326893762014-04-25T17:27:49Z2014-04-25T17:27:49ZHow to interpolate strings in appveyor.yml<div><p>The reason I need them is you don't seem to provide a way to
produce a<br>
oneclick build for exe distribution. I have to patch the csproj
file<br>
myself to get the versioning correct and supply different flags to
the<br>
build.</p>
<p>A well thought out oneclick builder for appveyor would help me a
great<br>
deal. Once I get it working you can have my scripts and figure out
how to<br>
integrate it. Some people are still delivering desktop apps these
days :)</p></div>bradphelantag:help.appveyor.com,2012-11-13:Comment/326893762014-04-25T17:34:14Z2014-04-25T17:34:14ZHow to interpolate strings in appveyor.yml<div><p>Desktop apps are cool - AppVeyor was started as a "deployment
tool" written in WPF :)</p>
<p>OK, I'll change build worker service to always set these env
variables for all build modes, but only if they are explicitly set
on UI on in appveyor.yml.</p>
<p>Setting them to AnyCPU/Release may cause "configuration not
found" on many projects - I'd prefer developers decide themselves
which configuration is default in solution/project files.</p></div>Feodor Fitsner