Last post Nov 19, 2007 04:29 AM by Benson Yu - MSFT
Nov 15, 2007 08:42 AM|bkejser|LINK
I created a web application that is dependent on an un-managemed assemlby, which is dependent on a win32 dll.
When I compile the web application from the Visual Studio IDE, a custom post compile script copies the win32 dll to the bin folder and everything works as expected.
When I run the web application from IIS, it is recompiled to the "%WINDIR%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" folder. Although the un-managed assembly is copied to the new recompile location, the win32 dll is not.
I am able to work around the problem by copying the win32 dll to the %WINDIR% folder, %WINDIR%\System32 folder or anywhere on the path. Since it is possible for a different version of the win32 dll to already exist in one of these locations,
this action may cause other applications to break.
Is there a way of getting the win32 dll copied to the recompile location?
Nov 19, 2007 04:29 AM|Benson Yu - MSFT|LINK
The native dll is not subjected to shadow copy. It is the by design behavior. In my opinion, the solution can be dynamically load that native dll with the path information as parameter. Please check the sample code in the following link for this scenario.
Dynamically calling an unmanaged dll from .NET (C#)