Topic: Different copies of one assembly

All greetings! The question is more for our experts so first of all it would be desirable to hear answers Nikov, Sinix, etc. Introduction If in Rozlinovsky compiler/cursor IDE to create two different projects (in one solution) and to give in their references to two with the same name and  assembly but containing different types or signatures (i.e. different on contents) it it is quiet with it works. In one project one signature is visible. In the friend, another. Truth at the assembly and start turns out an exception about mismatch of signatures so at compilation in the output-catalog one of these assembly (probably they is put overwrite each other), and  is quiet  the second  in the first as at them coincides . But if on to conjure,  it is possible to achieve correct operation of such program. In  it is difficult to load the assembly with identical  (with the identical: a name + the version + and without  a token) in same AppDomain. However by means of event AppDomain. CurrentDomain. AssemblyResolve, method Assembly. LoadFile and any mother I managed to load two IDENTICAL types from two with the same name and  assembly (supposed in two subdirectories). Thus types differed. They had functions with the same name with different signatures. The preface At creation of trees of name spaces and types (in the compiler or engine IDE) it is possible to go two ways: 1. To load separately each assembly constructing a tree of name spaces only for this assembly and then to construct on them the general tree of types for each project. Thus it is possible to load assembly out of a context of the specific project. If two projects refer to one assembly they will divide characters (types, name spaces, etc.) From identical assembly. 2. To load assembly in trees of name spaces and types of each project separately. Hierarchies in which the same assembly thus turns out to create refers to types from identical on a name and the version, but assembly different in the content. Advantage of a way 1 consists that characters are not doubled for each project. And it means that storage and procedure of design search of search of characters will be saved becomes simpler. Each project it will be simple to refer on same the character. As the first way allows to implement easily such counters as global  C# (an example: global:: SomeNamespace. SomeType). But at a choice of a way 1 it will not be possible to have different in contents, but identical on  (a name + the version +  to a token) the assembly as a part of different projects. After all in types there are links to types from referens-assemblages. If we load the assembly only once physically cannot create hierarchy for two different under the content  assembly. In general the such can turn out only by nonsense of developers not changed the version at assembly different in the content. But physically that it is possible. The second way is unpleasant to that at us untied symbol sets for each project turn out. And it not only storage losses, but also difficulty in search of characters within the limits of all solution. A question 1 Actually a question it is how much reasonable to select the first approach from that (with the single-valued loading of characters for assembly within the limits of all solution)? As though very much it would be desirable. But it is pricked. The question 2 Can be made a certain intermediate variant in which in the presence of identical hierarchy  assembly it will be possible to have identical hierarchy and to create parallel hierarchies otherwise.  it is not assured that explained all clearly. If that ask specifying questions.


Re: Different copies of one assembly

VD> in the presence of identical hierarchy  assembly To me it is not clear, why only for . In my opinion, if the assembly same in different projects - for it to create one structure in storage. And if two different copies to create two structures in storage...