I have a library - Foo.System.Management
I have an application - Foo.New.Application
In this application, Using System; is imported, and what ends up happening is this is being resolved to Foo.System and causes my project to throw error's saying
The type or namespace
Diagnosticsdoes not exist in the namespaceFoo.System
My assumption is that because of the same Base namespace Foo it is causing that resolution. Looking through the Namespace Docs I can't really find a clear explanation of this.
- What are my options in my
Foo.New.Application? - Some of those
Using System;directives are code generated so I cannot control aliasing. Should I just rename the library? - Is it bad practice to create a namespace like
Foo.Systemfor that reason?
Systemin one of my namespaces - if it confuses me, it's like to confuse the compiler. But, you can usually fix weird namespace issues by using the alias feature of theusingkeyword. Something likeusing Management = Foo.System.Management;. It may take some experimentation to get it right (and comfortable in your use case)Systemwas because I abstracted some generalSystemfunctions that we useusing System;directive outside any namespace declaration? Because then the using directive would sit in global namespace scope, with the closest "System" namespace the global::System namespace. Or can you configure the code generation to always generate using directives with the absolute namespace name rooted in global, i.e.,using global::System;instead of justusing System;?File.g.csfiles that are throwing the errors