tag:help.appveyor.com,2012-11-13:/discussions/questions/31318-using-variables-in-appveyorymlAppVeyor: Discussion 2019-06-27T05:27:39Ztag:help.appveyor.com,2012-11-13:Comment/466466592018-12-11T07:09:23Z2018-12-11T07:09:23ZUsing variables in appveyor.yml<div><p>For <code>cmd:</code> environment variables are accessed by surrounding variable name with <code>%%</code>.<br>
i.e. <code>%build%</code>, <code>%NuGetKey%</code></p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/466466592018-12-11T21:21:19Z2018-12-11T21:21:19ZUsing variables in appveyor.yml<div><p>Thanks for that - I replaced the line in question with:</p>
<pre>
<code>- cmd: dotnet nuget push Rn.Common.1.0.%version%.nupkg -k %NuGetKey% -s https://www.nuget.org/</code>
</pre>
<p>But it didn't seem to work:</p>
<p>cd bin/Release<br>
dotnet nuget push Rn.Common.1.0.%version%.nupkg -k %NuGetKey% -s <a href="https://www.nuget.org/">https://www.nuget.org/</a><br>
error: File does not exist (Rn.Common.1.0..nupkg).<br>
Command exited with code 1</p></div>niemand.richardtag:help.appveyor.com,2012-11-13:Comment/466466592018-12-11T22:00:59Z2018-12-11T22:00:59ZUsing variables in appveyor.yml<div><p><a href="https://www.appveyor.com/docs/environment-variables/">Here's</a> a list of environment variables set for every build. <code>Version</code> is not one of them, so unless you set it as an environment variable its not available. ...Perhaps you meant to use <code>APPVEYOR_BUILD_VERSION</code>.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/466466592018-12-11T22:43:20Z2018-12-11T22:43:20ZUsing variables in appveyor.yml<div><p>Thanks for that - I gave up on the venture because I was concerned of exposing my API key in the build log, and had a lot more success with a PowerShell script, namely:</p>
<p><a href="https://github.com/rniemand/Rn.Common/blob/master/appveyor.yml">https://github.com/rniemand/Rn.Common/blob/master/appveyor.yml</a></p>
<p>and</p>
<p><a href="https://github.com/rniemand/Rn.Common/blob/master/build/package.ps1">https://github.com/rniemand/Rn.Common/blob/master/build/package.ps1</a></p>
<p>Appreciate all the help!</p></div>niemand.richard