tag:help.appveyor.com,2012-11-13:/discussions/problems/22317-nugetapikey-not-setAppVeyor: Discussion 2019-03-20T20:55:37Ztag:help.appveyor.com,2012-11-13:Comment/470859342019-03-18T22:33:04Z2019-03-18T22:33:04ZNuGetApiKey Not Set<div><p>I'm guessing you may have started with some UI configuration and then switched to <code>appveyor.yml</code> and in the UI you don't have this variable set?<br>
Seems your config file is not being respected because of its casing. Can you switch to all lowercase <code>appveyor.yml</code> and try running the build</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/470859342019-03-19T12:35:28Z2019-03-19T12:35:28ZNuGetApiKey Not Set<div><p>You are correct! I did not set the variable via the UI. I lowercased the file and that did seem to change something: namely it broke the build as I had the script called wrong in my YML file. Fixed that but the build is still throwing the NuGetApiKey error.</p>
<p>(I had no idea the file name was case sensitive, thanks for that!)</p></div>dustin+appveyortag:help.appveyor.com,2012-11-13:Comment/470859342019-03-19T14:13:02Z2019-03-19T14:13:02ZNuGetApiKey Not Set<div><p>Again i'm guessing, but maybe <a href="https://github.com/ReArmedHalo/DUST/blob/master/deploy.PSDeploy.ps1#L6">here</a> you should change this line from</p>
<pre>
<code>ApiKey = $ENV:NuGetApiKey</code>
</pre>
<p>to</p>
<pre>
<code>NuGetApiKey = $ENV:NuGetApiKey</code>
</pre></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/470859342019-03-19T14:39:09Z2019-03-19T14:39:09ZNuGetApiKey Not Set<div><p>Thanks! But per the <a href="https://psdeploy.readthedocs.io/en/latest/Example-PSGalleryModule-Deployment/">PSDeploy docs</a>, that should be ApiKey.</p>
<p>For the hell of it, I gave that a try: <code>WithOption 'NuGetApiKey' is not a valid parameter for 'PSGalleryModule'</code></p>
<p>I believe the issue is still on my AppVeyor configuration as I did the dumb and purposefully wrote out <code>Write-Host $env:NuGetApiKey</code> and the output was blank during a build, other variables show up just fine it seems.</p></div>dustin+appveyortag:help.appveyor.com,2012-11-13:Comment/470859342019-03-19T14:50:01Z2019-03-19T14:50:01ZNuGetApiKey Not Set<div><p>Just to confirm everything actually works elsewhere, I went into the settings on AppVeyor UI for the build (<a href="https://ci.appveyor.com/project/ReArmedHalo/dust/settings/environment">https://ci.appveyor.com/project/ReArmedHalo/dust/settings/environment</a>) and set the NuGetApiKey env variable to the unsecure string. Pushed a build and it published properly. This takes me back to believe I'm doing something wrong in my config or the yml file itself.</p></div>dustin+appveyortag:help.appveyor.com,2012-11-13:Comment/470859342019-03-19T18:03:33Z2019-03-19T18:03:33ZNuGetApiKey Not Set<div><p>Indeed it seems you are following the proper apikey naming.</p>
<p>Everything looks ok in your <code>appveyor.yml</code>. It really seems like the decryption is just not happening properly<br>
. Can you try encrypting a test variable and then print it out from the psake script as i did in <a href="https://ci.appveyor.com/project/OwenMcDonnell/dust/builds/23193587">this build</a> of a fork of your project.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/470859342019-03-20T14:30:35Z2019-03-20T14:30:35ZNuGetApiKey Not Set<div><p>Huh, blank for me.</p>
<p><a href="https://ci.appveyor.com/project/ReArmedHalo/dust/builds/23223646">https://ci.appveyor.com/project/ReArmedHalo/dust/builds/23223646</a><br>
<a href="https://github.com/ReArmedHalo/DUST/tree/develop">https://github.com/ReArmedHalo/DUST/tree/develop</a></p>
<p>I have in my project settings in the UI under Environment, Build Worker System is set to WMF 5. Is this overriding all the settings from my YML file? I just tried to delete that (which resets it back to VS 2015 in the UI) and tried to rebuild, no change. Foo is still blank.</p></div>dustin+appveyortag:help.appveyor.com,2012-11-13:Comment/470859342019-03-20T14:59:41Z2019-03-20T14:59:41ZNuGetApiKey Not Set<div><p>It's the other way around. Presence of yaml config file in repo overrides settings from UI, except for certain settings. You can read more details <a href="https://www.appveyor.com/docs/build-configuration/#appveyoryml-and-ui-coexistence">here</a>.</p>
<p>In the build you linked to I don't see the test variable declared in <code>appveyor.yml</code>. Did you set it in the UI?</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/470859342019-03-20T15:18:19Z2019-03-20T15:18:19ZNuGetApiKey Not Set<div><p>Oh right, sorry I got mixed up here!</p>
<p>I linked to the wrong build sorry about that! <a href="https://ci.appveyor.com/project/ReArmedHalo/dust/builds/23224404">https://ci.appveyor.com/project/ReArmedHalo/dust/builds/23224404</a></p>
<p>It did work in the end, I basically used the UI to create the YAML file and the used export YAML to build my .yml file. The foo variable then was output properly.</p>
<p>I moved my changes back to my master branch, updated the exported YML and removed or turned off all settings in the UI (just to be safe) and pushed a build through. Everything appears to be working great now!</p>
<p>Not really sure what I did differently that caused it but perhaps it was me using <code>OS: WMF</code> instead of image?</p>
<p>Thank you for your help! :)</p></div>dustin+appveyortag:help.appveyor.com,2012-11-13:Comment/470859342019-03-20T20:55:34Z2019-03-20T20:55:34ZNuGetApiKey Not Set<div><p>No problem. Yeah, it's best to stick to one configuration method, although environment variables set in the UI should get merged with those in the configuration file.</p></div>Owen McDonnell