In principle, I would prefer to declare my usings in C#. I don't love to edit my csproj
files, but Martin remembered me that I can do it in a Directory.Build.props
file (if you want to know more about this file, take a look at this post that I've written to see the potential).
The beauty of it is that if you place Directory.Build.props
in the root folder that contains your source code, when MSBuild runs will add to every project the properties defined in the Directory.Build.props
. So, if you want to do it Solution wise or even only for your Test folder, you can do it.
I will be using Directory.Build.props
for sure. At least until we see a new standard way to declare global usings emerging in the community.
I hope that this was useful! To get more tips like this, follow me on Twitter (@gsferreira) and let's keep in touch!