c# – vscode/Visual Studio Find and Replace in the commandline


I am trying to move from the default Assert to FluentAssertions in my c# project.
In order to achieve this i wrote some Regex-FindAndReplace “commands” if you can call it like that.

Find:    \sAssert.IsTrue\((.+?)\)\; 
Replace: ($1).Should().BeTrue();

These commands are working very good, so now i am trying to write a script with multiple of those “commands”, since we have a lot of Repos.

The big problem:
i cannot find a way to execute the “Find and Replace” in the Terminal or the Visual Studio Command Window. I am looking for something like: dotnet replace --regex "\sAssert.IsTrue\((.+?)\)\;" "($1).Should().BeTrue();"

Has anyone ever done that? I can’t find any working solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *