So I'm currently in the process of creating some Item Templates in visual studio for some commonly used classes I have to make. During this task I've run in to another problem.
I'm using folders prefixed with _ as sort of grouping folders that don't affect the namespace. However, when I create a new item in one of these folders, the _Folder is automatically appended to the workspace like so:
namespace Core.Parser._Filters
Usually I would just go by hand and remove the prefixed folders from the namespace, but since I'm trying to automate this process that's no longer an option.
So I've thought of 2 ways i could solve this, but I'm not sure how they would work in practice or if they're even possible.
1) Would it somehow be possible to tell VS to exclude a folder from namespace construction? Similarly to how you can set the Build Action on .cs files to None so VS skips over them during compile.
2) Would it be possible to add a modifier to the Item Template which strips out the prefixed folders from $rootnamespace$? Something like ($rootnamespace$).Replace("._Filters", "");
This will prevent Visual Studio from using the folder name as part of the namespace (if ReSharper is installed):
Right-click on folder -> Properties -> NamespaceProvider = false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With