Conditional build configuration for branches in appconveyor.yml

Rainer Zillerq's Avatar

Rainer Zillerq

20 Mar, 2015 11:05 PM

This is driving me crazy. I want to have different configurations for different branches, and deploy them to different environments.

The validator at https://ci.appveyor.com/tools/validate-yaml thinks it is all fine, but when I try to build my project, it will fail when trying to execute the before_build event, with this error:
if($true)
The syntax of the command is incorrect.
Command exited with code 255

I can get behind what I am doing wrong here with the multiline built event. From what I can see, I do it exactly like in the documentation.

I am on this simple thing like 2 hours, and this is so frustrating!
Hope someone can help me :)

  1. Support Staff 1 Posted by Feodor Fitsner on 21 Mar, 2015 04:55 AM

    Feodor Fitsner's Avatar

    That's the easy one - it should be prefixed with ps::

    before_build:
    - ps: >-
        if($true)
    
        {
          nuget restore
          $xml = [xml](Get-Content 'C:\projects\backend\iDiscover.Cloudservice\ServiceDefinition.csdef')
          $xml.ServiceDefinition.WebRole.SetAttribute("vmsize","small")
          $xml.Save('C:\projects\backend\iDiscover.Cloudservice\ServiceDefinition.csdef')
        }
    

    You can always put the script on project settings UI and then use "Export YAML" feature.

  2. 2 Posted by Rainer Ziller on 21 Mar, 2015 09:23 AM

    Rainer Ziller's Avatar

    Oh, hadn't noticed the export YAML feature. If I only had seen that yesterday :D
    All working now.

    Thank you very much, your support is amazing. Answers are coming so fast :)

  3. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:54 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac