So a few years ago I worked with Jaap Lamfers. Jaap showed me a tool to easily replace .csproject names and namespaces. This tool is named Bire.
Why you should care
Renaming files is hard. When renaming Projects in Visual Studio the Folder does not change and keeps its original name. The project path is declared in the Solution file (.sln). Not a problem when working in Visual Studio, but a minor annoyance when reviewing a pull request.
Also when renaming projects via Visual Studio, not all namespaces will change as well. And when renaming manually you need to change the references as well in the contents of the .csproject file.
Jaap encountered a problem where with microservices he needed to build and the namespaces could be changed afterward. The company used abbreviations for services, with bire he just could build and change the name afterward with a single command.
The tool of Jaap is available at Github jlamfers/bire.
I thought his tool was brilliant, but it missed the crucial documentation to make it understandable for the whole company.
bire -from C:\git\source -to C:\git\target -replace this=that Something=Anything
This is an example I wrote in the Readme file. But I want to give you a more concrete example let’s imagine this folder structure. The project is in
Let’s say we don’t like
MyCoolProject anymore and we want to rename it to
Then we can use Bire. Download the bire.exe from my GitHub release 1.
Use the following command to get MyCoolProject abbreviated to MCP.
We’re not copying the project we don’t need the
-to param. You should have your repo in git to do this change safely right?
Ignoring the right files and file types
What if we would have certain files that would refer to MyCoolProject and we want them to stay that way instead of renaming
MCP. For example a
Bire helped me a lot at some companies. Let tools help you and get grip on your time back. Let it be another tool in your toolbox. Let me know if you have used bire and liked it.