Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET - How do I stop classes/dlls from one project being compiled into another project
    primarykey
    data
    text
    <p>I have one of those annoying problems where something that used to work stopped working. Check out this code:</p> <pre><code>Assembly _abc_assembly = Assembly.LoadFile(“c:\junk\abcabstract\bin\abc.dll”); ABC.ContentAttribute attribute; attribute = (ABC.ContentAttribute)_abc_assembly.CreateInstance("ABC.TextAttribute"); </code></pre> <p>ContentAttribute is defined in the dll. Obviously, this should work. You should be able to cast an object to itself.</p> <p>But it produces this error:</p> <p><a href="http://www.yart.com.au/stackoverflow/compile1.png" rel="nofollow noreferrer">alt text http://www.yart.com.au/stackoverflow/compile1.png</a></p> <p>This bug is discussed here <a href="http://www.yoda.arachsys.com/csharp/plugin.html" rel="nofollow noreferrer">http://www.yoda.arachsys.com/csharp/plugin.html</a> which is how I got even this far. From this post I gather that the class ContentAttribute is somehow ending up in ABC.DLL <strong>and</strong> the website project's DLL.</p> <p>The website project I have looks like this:</p> <p><a href="http://www.yart.com.au/stackoverflow/compile2.png" rel="nofollow noreferrer">alt text http://www.yart.com.au/stackoverflow/compile2.png</a></p> <p>Now ContentAttribute is not in this project, it is in the dll ABC.DLL. You can see that as I have expanded every branch and the file ContentAttribute.cs is not there.</p> <p>Yet somehow it is ending up in the dll for the website creating a duplicating reference. ContentAttribute is somehow ending up in ABC.DLL and the website project's DLL.</p> <p>Can anyone tell me:</p> <p>a) Why is ContentAttribute in two dlls? I didn’t think including a dll in a project forced that code into the projects DLL.</p> <p>b) How to stop it from happening?</p> <p>By the way, I definitely don't want to change the website project into a website application if I can avoid it.</p> <p>Notes:</p> <p>Deleting the temporary ASP.NET files does not work. As soon as I compile my website project they get recreated.</p> <p><a href="http://www.yart.com.au/stackoverflow/compile3.png" rel="nofollow noreferrer">alt text http://www.yart.com.au/stackoverflow/compile3.png</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload