0

I'm trying to run a cake build script that loads a module for long file path but it only returns error CS1024: Preprocessor directive expected

In the cake file I have added #module nuget:?package=Cake.LongPath.Module&version=0.5.0 and this is the line where I get the error at (1,2)

In the docs It states that this is the format and that I should run the script with --bootstrap before actually running the script. Running Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" --bootstrap" causes a the error and then I also get it on the line after when running it without the --bootstrap flag.

What I need is to make sure that Cake.LongPath module is installed and loaded in CI. Any thoughts on other solutions would also be helpful

Binke
  • 897
  • 8
  • 25
  • 1
    Can you confirm what version of Cake you are using? – Gary Ewan Park Mar 06 '18 at 12:58
  • Can you confirm that this is the command that you are running `Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" --bootstrap"` Notice that the bootstrap argument is actually outside of the Invoke-Expression, which is not correct. – Gary Ewan Park Mar 06 '18 at 13:04
  • Write-Host outputs: `& "C:\...\Cake.exe" "build.cake" --bootstrap`. Cake version is set to 0.18 in packages.config though, so I guess it's quiet old. Tried using #load for the nuget package and it swallowed it, but not sure if it actually works – Binke Mar 06 '18 at 14:15
  • The #load directive is intended for loading in other .cake files, or nuget packages that contain .cake files, not for modules or anything else. – Gary Ewan Park Mar 06 '18 at 14:20

1 Answers1

1

The --bootstrap command was only added in Version 0.24.0 of Cake. You can see the release notes here:

https://github.com/cake-build/cake/releases/tag/v0.24.0

And the issue that it was worked on here:

https://github.com/cake-build/cake/issues/1950

I am fairly sure that this issue will be solved by upgrading to a newer version of Cake. This can be done by changing the version number in the packages.config file, and by clearing out the tools folder. NOTE: Depending on what version of the bootstrapper you are using, the clearing out of the tools folder may be done for you automatically.

Gary Ewan Park
  • 17,610
  • 5
  • 42
  • 60
  • 1
    Yes, just updated and tried and it seems to work, should have been the first thing I tried but sometimes the easy solutions slip your mind – Binke Mar 06 '18 at 14:31