Does anybody know, in a .tt file, where code.VsNamespaceSuggestion() gets its namespace from?
I'm having an issue where I had to change a solution's namespace, and I swear I've changed it everywhere (folder names, filenames, project names, project properties, assembly info, etc). But when the .tt file runs, it always puts the old namespace back in its generated classes. I'm told it comes from the EF model, but I see nothing in there that shows a namespace (either in the designer/properties or by opening the .edmx file in NotePad).
Any thoughts? For a hack, I'm simply overriding it in the next line with the namespace I want:
string namespaceName = code.VsNamespaceSuggestion(); namespaceName = "Desired.Namespace"; //HACK:
Just had this exact problem, and the solution I discovered wasn't mentioned here, so I thought I'd help anyone that came across this article in a search.
Click on the code-generation *.tt file that is generating your entities. In the properties pane, set the Custom Tool Namespace to the namespace you would like generated. Mine was blank, so T4 was generating the namespace from the default project namespace + folder heirarchy.
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