You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When executing a Cake script that includes a custom add-in, the following error is shown:
Compiling build script...
Error: Cake.Core.CakeException: Error(s) occurred when compiling build script:
(2955,122): error CS1009: Unrecognized escape sequence
at Cake.Scripting.Roslyn.RoslynScriptSession.Execute(Script script)
at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
at Cake.Commands.BuildCommand.Execute(CakeOptions options)
at Cake.CakeApplication.Run(CakeOptions options)
at Cake.Program.Main()
What is Expected?
The compilation and execution of the build script.
What version of Cake are you using?
I have seen this error with versions 0.29.0, 0.33.0 and 0.35.0
Are you running on a 32 or 64 bit system?
I am running a 64-bit system.
What environment are you running on? Windows? Linux? Mac?
The environment we are running on, is a Windows environment.
Are you running on a CI Server? If so, which one?
The build is both failing on a local machine, as well as on our TeamCity build server.
Additional troubleshooting information
After cloning the Cake github repository, I was able to take a look at the build script that was executed. (Having this in a file for diagnostic purposes would be extremely helpful ;))
This pointed me to a method in our add-in that contained the following signature:
Class A:
[CakeMethodAlias]
public static void DoSomething(this ICakeContext context, string value = Constants.DefaultValue) { ... }
Class B ('Constants'):
public const string DefaultValue = @".\Output";
In the script this got translated to:
[CakeMethodAlias]
public static void DoSomething(this ICakeContext context, string value = ".\Output") { ... }
Note the absence of the literal character '@'.
I managed to work-around this problem by using either of the following implementations in the add-in:
a)
Class A:
[CakeMethodAlias]
public static void DoSomething(this ICakeContext context, string value = default(string))
{
value = value ?? Constants.DefaultValue;
...
}
Class B ('Constants'):
public const string DefaultValue = @".\Output";
b)
Class A:
private const string DefaultValue = @".\Output";
[CakeMethodAlias]
public static void DoSomething(this ICakeContext context, string value = DefaultValue) { ... }
The text was updated successfully, but these errors were encountered:
What You Are Seeing?
When executing a Cake script that includes a custom add-in, the following error is shown:
Compiling build script...
Error: Cake.Core.CakeException: Error(s) occurred when compiling build script:
(2955,122): error CS1009: Unrecognized escape sequence
at Cake.Scripting.Roslyn.RoslynScriptSession.Execute(Script script)
at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
at Cake.Commands.BuildCommand.Execute(CakeOptions options)
at Cake.CakeApplication.Run(CakeOptions options)
at Cake.Program.Main()
What is Expected?
The compilation and execution of the build script.
What version of Cake are you using?
I have seen this error with versions 0.29.0, 0.33.0 and 0.35.0
Are you running on a 32 or 64 bit system?
I am running a 64-bit system.
What environment are you running on? Windows? Linux? Mac?
The environment we are running on, is a Windows environment.
Are you running on a CI Server? If so, which one?
The build is both failing on a local machine, as well as on our TeamCity build server.
Additional troubleshooting information
After cloning the Cake github repository, I was able to take a look at the build script that was executed. (Having this in a file for diagnostic purposes would be extremely helpful ;))
This pointed me to a method in our add-in that contained the following signature:
Class A:
[CakeMethodAlias]
public static void DoSomething(this ICakeContext context, string value = Constants.DefaultValue) { ... }
Class B ('Constants'):
public const string DefaultValue = @".\Output";
In the script this got translated to:
[CakeMethodAlias]
public static void DoSomething(this ICakeContext context, string value = ".\Output") { ... }
Note the absence of the literal character '@'.
I managed to work-around this problem by using either of the following implementations in the add-in:
a)
Class A:
[CakeMethodAlias]
public static void DoSomething(this ICakeContext context, string value = default(string))
{
value = value ?? Constants.DefaultValue;
...
}
Class B ('Constants'):
public const string DefaultValue = @".\Output";
b)
Class A:
private const string DefaultValue = @".\Output";
[CakeMethodAlias]
public static void DoSomething(this ICakeContext context, string value = DefaultValue) { ... }
The text was updated successfully, but these errors were encountered: