Assembly resolver issue in web application RRS feed

  • Question

  • Hi All,

    I have a web application running under IIS server, which is referring desktop application’s assemblies.

    I need to refer dependent DLL from desktop application’s installation path (e.g. C:\Program file\ApplicationV2\).

    In my current scenario, I am able to resolve dependent DLL, which has a direct reference, but if the instance of dependent DLL is created dynamically (through reflection) then the assembly resolver is failed to load the dependent DLL. The compiler giving an error “Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\myappdomain\879cbc93\806ed4e1\assembly\dl3\1be953eb\c09ec85a_7ae7d301\Helper.dll' or one of its dependencies. The system cannot find the file specified.”

    Dependent DLL must be load in the same ASP.NET temp folder where the main DLL is executing.

    If we tried to load dependent DLL separately then it is loading into a different ASP.NET temp folder, which is not useful.

    Does anyone have an idea on this problem? Alternative approaches are always appreciated.

    Thanks in Advance.

    • Moved by CoolDadTx Tuesday, May 29, 2018 1:52 PM ASP.NET related
    Monday, May 28, 2018 12:30 PM

All replies

  • What kind of desktop application, while sometimes necessary for some kind of unsupported tasks, it's pretty uncommon?

    Monday, May 28, 2018 12:38 PM
  • Hi Sayyed Azim,

    Thank you for posting here.

    Since your question is more related to ASP.NET, you could post a new thread in ASP.NET forum for suitable support.


    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 29, 2018 6:57 AM
  • Hi Stefan,

    I have implemented desktop application using WPF and same application I have to create for web for remote access in LAN, which is possible using IIS server hosting. Both the application is residing in local machine; however, web version of application can be accessible to different machine through LAN.

    Since desktop application is already implemented, I want to reuse the existing code by referring desktop application's assemblies, due to that I am using assembly resolver technique to achieve my goal, although it is working fine .The only problem is for loading dependent assembly, which is dynamically referring other DLL through reflection. 

    e.g: My web application is referring A.dll and that A.dll is creating instance of B.dll dynamically (via reflection), that means in runtime A.dll is depend on B.dll.

    Thanks & Regards,

    Sayyed Azim

    Tuesday, May 29, 2018 9:46 AM
  • To reuse code from your desktop application, you need a project structure like this:

    Where you place the common (shared) code in a separate class library. You need a unit test project to test your library.

    Now you reference the common class library in your desktop application as well as in your web application.

    Depending on your kind of application, it can make sense to have more than one common class library.

    You should definitively not load any of your existing code manually (dynamically). Cause this can raise security issues.

    Tuesday, May 29, 2018 10:44 AM