I've been tackling some odd behaviour I have with my Visual Studio. I am generating pakage with simple Silo.Configuration
namespace in it having two types in one file.
- Contents of the file:
namespace Silo.Configuration{ public enum ClusteringType { Local, Zookeeper } public class SiloConfig { public string URL { get; set; } public string ClusterId { get; set; } public string ServiceId { get; set; } public ClusteringType ClusteringType { get; set; } public int GatewayPort { get; set; } public int SiloPort { get; set; } }}
Silo.Configuration
is the default namespace and assembly name for the package I create via Visual Studio with<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
option.
So far so good, but when I try to use this package in other project nested inside other namespace I get CS0234. Weird thing comes when I move Silo.Configuration
in global namespace or add using global:: this fixes the error and type is resolved.
Question is what is this behaviour and how can I fix it? Before you answer I noticed when I was able to resolve SiloConfig
from the other project I wanted it to be included it was looking like that
using Silo.Configuration; // <-- notice this?namespace Silo.Configuration{ public class SiloConfig { public SiloConfig(); public string URL { get; set; } public string ClusterId { get; set; } public string ServiceId { get; set; } public ClusteringType ClusteringType { get; set; } public int GatewayPort { get; set; } public int SiloPort { get; set; } }}
What does generate this using above the SiloConfig
type if the namespace is the same?