There are two overloads of ReplaceNode()
(both are extension methods):
public static TRoot ReplaceNode<TRoot, TNode>( this TRoot root, TNode oldNode, TNode newNode) where TRoot : CommonSyntaxNode where TNode : CommonSyntaxNode;
in
Roslyn.Compilers.CommonSyntaxNodeExtensions
.public static TRoot ReplaceNode<TRoot>( this TRoot root, SyntaxNode node, SyntaxRemoveOptions options, Func<SyntaxNode, SyntaxTriviaList> keepLeadingTrivia = null, Func<SyntaxNode, SyntaxTriviaList> keepTrailingTrivia = null) where TRoot : SyntaxNode
in
Roslyn.Compilers.CSharp.SyntaxExtensions
.
You want the first one, but the error message talks about the second one, which indicates that you're missing using Roslyn.Compilers;
.