Note that there are some explanatory texts on larger screens.

plurals
  1. POHow is ASP.NET finding my class library?
    primarykey
    data
    text
    <p>I have been asked to update a class library DLL that is being used by an ASP.NET application that someone else created. However, when I looked at the folder structure for the ASP.NET app, I found that the DLL existed under two different folders, and it looks like the app uses one DLL when you first run it, but the other after you restart IIS. I plan on fixing things up so the DLL only exists once in the application, but I'd like to understand what is happening first.</p> <p>Here's the deal - the DLL is called MyLib.DLL and it exists in both a BIN subfolder and a folder called MyLibrary. Here's an example of how an ASPX page in the app calls a method in the class library:</p> <pre><code>Dim oMyClass As New MyLib.MyClass Dim sTemp As String = oMyClass.GetVersion() </code></pre> <p>The application also has this section in the web.config file:</p> <pre><code>&lt;runtime&gt; &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt; &lt;dependentAssembly&gt; &lt;assemblyIdentity name="MyLib" culture="neutral"/&gt; &lt;codeBase version="1.0.0.0" href="MyLibrary/MyLib.dll"/&gt; &lt;/dependentAssembly&gt; &lt;/assemblyBinding&gt; &lt;/runtime&gt; </code></pre> <p>Since the app had two different copies of MyLib.DLL, I updated both and had the GetVersion function return different results so I could tell which DLL was being used. When I run the app for the very first time, I can see that ASP.NET is creating a folder under the "Temporary ASP.NET Files" folder and it makes a copy of the BIN version of MyLib.DLL. And the app will return "From BIN folder" when calling the GetVersion function. However, if I restart IIS and run the app again, GetVersion will start returning "From MyLibrary folder", indicating that it is now using the DLL from the MyLibrary folder rather than the BIN folder.</p> <p>So, why is ASP.NET using the BIN version of the DLL first, but then using the one specified in the Codebase setting after a restart of IIS? If I wanted to get rid of the BIN version of the DLL, how can I configure the application to only use the copy in the MyLibrary folder? I tried getting rid of the BIN version, but then the app gave me an error that the assembly could not be found.</p> <p>Thanks - I'm new to ASP.NET so I hope this question made sense.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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