appveyor / ci

AppVeyor community support repository
https://www.appveyor.com
344 stars 65 forks source link

Shell-like variable notation does not work with .NET Core .csproj pathing #2078

Open IlyaFinkelshteyn opened 6 years ago

IlyaFinkelshteyn commented 6 years ago

Check also AssemblyInfo patching.

Discussion

Zingam commented 5 years ago

Is this related to the issue that environment variables set it one script section are not available in another like that:

init:
  - pwsh: |
       $env:var1 = "1"

install:
  - pwsh: |
      if ("1" -eq $env:var1)
      {
        ...
      }
IlyaFinkelshteyn commented 5 years ago

@Zingam no, this is unrelated issue. Regarding problem you describing, it is known issue related to the way PowerShell Core execution implemented on AppVeyor Windows builds. For this specific scenario, I would recommend to replace pwsh with ps: it will run properly on classic PowerShell on Windows and PowerShell Corfe on Linux.

Zingam commented 5 years ago

@IlyaFinkelshteyn pwsh has some improved functionality compared to the older PowerShell. Will the implementation be fixed, including calling .bat scripts from PowerShell without the need to resolve to tricks to set environment variables (this is a second issue -> dump the env vars set by the bat file to a file and import them into powershell)? The main reason I looked at pwsh is that https://www.appveyor.com/docs/linux-images-software/ lists PowerShell Core as the only option on Linux. I am in the process to fix my scripts to be cross-platform and I hope to use it without modifications on Linux too. You mean that ps is actually PowerShell Core on Linux? OK! Thank you!

IlyaFinkelshteyn commented 5 years ago

Yes. both ps and pwsh prefixes call PowerShell Core on Linux. So syntax will be seamless for you. Or if you decide to run environment variable set up in separate ps command and all other command as pwsh this should work and look the same on both platforms.