Given a carriage return delimited text file say of folder names, how do I read this file into List in the Cake build system for C#?
When I try to use the File class, it complains that File(string) is a method, which is not valid given the context:
filePath filePath;
string fileContents = File.ReadAllText(filePath FullPath);
How would I write this so it works with Cake?
Cake has its own
Fileclass, so there's a namespace conflict where the compiler doesn't know whichFileclass you want to use.You have to fully-qualify the type name in your call, to include the
System.IOnamespace:You might also be interested in the Cake.FileHelpers addin which adds a set of aliases for Cake to help with simple file operations such as Reading, Writing and Replacing text.