After upgrade from 4.x to 2018.8.6 our C# scripts (in our deployment steps, e.g. for pre-deployment of Azure App Service deployment) are no longer working and blocking most of our deployments.
The error for all is basically the same:
ERROR: Script compilation failed. [CompilationErrorException] C:\Octopus\Work\20181217232007-49732-14\staging\Octopus.AzureContext.ps1(1,1): error CS1024: Preprocessor directive expected
December 18th 2018 12:20:20Error
PreDeploy script returned non-zero exit code: 1
December 18th 2018 12:20:20Error
Running rollback conventions...
December 18th 2018 12:20:20Error
PreDeploy script returned non-zero exit code: 1
One of our simpler scripts is as follows:
if(Octopus.Parameters["DoProductionRobots"] == "True") {
Console.WriteLine("Replacing robots.txt with Production version");
File.Delete("wwwroot\\robots.txt");
File.Move("wwwroot\\robots.production.txt", "wwwroot\\robots.txt");
}
Googling this error doesn’t bring up anything useful.
This was working in our previous version of Octopus (4.0.9)