diff --git a/src/MessagePackCompiler/MessagePackCompilation.cs b/src/MessagePackCompiler/MessagePackCompilation.cs index edd03472b..233d947c8 100644 --- a/src/MessagePackCompiler/MessagePackCompilation.cs +++ b/src/MessagePackCompiler/MessagePackCompilation.cs @@ -43,7 +43,7 @@ public static async Task CreateFromProjectAsync(string[] cspr var hasAnnotations = false; foreach (var file in sources.Distinct()) { - var text = await File.ReadAllTextAsync(file, Encoding.UTF8, cancellationToken); + var text = await File.ReadAllTextAsync(file.Replace('\\', Path.DirectorySeparatorChar), Encoding.UTF8, cancellationToken); var syntax = CSharpSyntaxTree.ParseText(text, parseOption); syntaxTrees.Add(syntax); if (Path.GetFileNameWithoutExtension(file) == "Attributes") @@ -167,7 +167,7 @@ public static async Task CreateFromDirectoryAsync(string dire var syntaxTrees = new List(); foreach (var file in IterateCsFileWithoutBinObj(directoryRoot)) { - var text = await File.ReadAllTextAsync(file, Encoding.UTF8, cancellationToken); + var text = await File.ReadAllTextAsync(file.Replace('\\', Path.DirectorySeparatorChar), Encoding.UTF8, cancellationToken); var syntax = CSharpSyntaxTree.ParseText(text, parseOption); syntaxTrees.Add(syntax); if (Path.GetFileNameWithoutExtension(file) == "Attributes")