c# - Castle Windsor Namespace conflicts -
say i'm working inside namespace called, example, org.company , namespace contains myclass. i'm importing nuget namespace called company class named otherclass.
so, when i'm working inside org.company namespace, can't following:
company.otherclass obj;
because compiler assumes mean:
org.company.otherclass obj
which doesn't exist.
so, far know, instead of using qualified name, must import other namespace such using company;
the problem, however, need reference otherclass from xml file (castle windsor configuration file) , qualified name company.otherclass isn't working. there way around this? changing namespace names isn't viable option.
edit: have on castle windsor xml file
<using assembly="myproj, version=1.0.0.0, culture=neutral" /> ... <component service="company.iotherclass" type="company.otherclass" /> i following error:
{"could not convert string 'company.otherclass' type. make sure assembly containing type has been loaded process, or consider specifying assembly qualified name of type."}
probably because looking inside org.company instead, defined in myproj assembly.
i assume fixed if there way add <using /> statement referencing nuget package... there way that?
as far understand problem referencing xml? right?
so castle.windsor suggests "consider specifying assembly qualified name of type.". mean? means instead of:
<component service="company.iotherclass" type="company.otherclass" /> you should give class names assembly coming from:
<component service="company.iotherclass, otherclassassembly" type="company.otherclass, otherclassassembly" /> or qualified assembly name:
<component service="company.iotherclass, otherclassassembly, version=..., culture=..., publickeytoken=..." type="company.otherclass, otherclassassembly, version=..., culture=..., publickeytoken=..." /> note: replace otherclassassembly actual assembly name , don't add .dll extension here note: see http://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname.aspx more details, example how deal nested classes
to use otherclass in code, well, can use global
global::company.otherclass you can use using:
using company; or import 1 class:
using classfromothercompany = company.otherclass;
Comments
Post a Comment