int keyword is not recognized by AppVeyor despite compile ok on VS 2019

fred's Avatar

fred

22 Apr, 2019 06:44 PM

hello,
my project UsefulFunctions compiles correctly in my Visual Studio 2019 targeting 4.7.2 .net framework but it fails on AppVeyor stating that int is not a known expression :
FunctionsMath.cs(364,16): error CS1525: Invalid expression term 'int' [C:\projects\usefulfunctions\FonctionsUtiles.Fred.Csharp\FunctionsUseful.Fred.Csharp.csproj]

here is the code :
 foreach (var number in result)
      {
        switch (number)
        {
          case int _ when number < 10:
            result[0]++;
            break;
          case int _ when number >= 10 && number <= 19:
            result[1]++;
            break;
          case int _ when number >= 20 && number <= 29:
            result[2]++;
            break;
          case int _ when number >= 30 && number <= 39:
            result[3]++;
            break;
          case int _ when number >= 40:
            result[4]++;
            break;
        }
      }
What is the problem ?

  1. Support Staff 1 Posted by Owen McDonnell on 22 Apr, 2019 07:02 PM

    Owen McDonnell's Avatar

    Which build image are you using

  2. 2 Posted by fred on 24 Apr, 2019 10:37 PM

    fred's Avatar

    I used VS2015 image and I changed it to VS 2019 preview image and I have the same error.

  3. Support Staff 3 Posted by Owen McDonnell on 25 Apr, 2019 04:59 AM

    Owen McDonnell's Avatar

    I forked your repo and the first build i tried with Visual Studio 2017 image worked, where as default image (Visual studio 2015) failed.

    You probably tried to change the image in the UI but since you have a configuration file it is overriding. See here for details on the interaction between config file and UI config.

  4. 4 Posted by fred on 26 Apr, 2019 09:54 PM

    fred's Avatar

    I have choosen VS2017 like you and
    I have copied your appveyor.yml file to my repo and it doesn't build.
    I don't know what is different ?

  5. Support Staff 5 Posted by Owen McDonnell on 26 Apr, 2019 10:10 PM

    Owen McDonnell's Avatar

    Point me to a build in which you have chosen VS2017.

  6. 6 Posted by fred on 01 May, 2019 09:14 PM

    fred's Avatar

    If you can access to my settings,
    https://ci.appveyor.com/project/fredatgithub/usefulfunctions/settings/environment

    you will see that I use a VS2017 image.

  7. Support Staff 7 Posted by Owen McDonnell on 01 May, 2019 11:25 PM

    Owen McDonnell's Avatar

    A quote from my response above....

    You probably tried to change the image in the UI but since you have a configuration file it is overriding. See here for details on the interaction between config file and UI config.

    Please follow the link and read.

  8. 8 Posted by fred on 03 May, 2019 04:18 PM

    fred's Avatar

    I found it
    I have added
    image:
      Visual studio 2017
    in my appveyor.yml file and it is ok now
    thanks for your help

  9. Owen McDonnell closed this discussion on 03 May, 2019 05:04 PM.

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