Hi all,

We have a framework that consists of both managed and unmanaged assemblies.
The managed assembies depend on the unmanaged assemblies. Some are connected
using dllimport (e.g. [DllImport("kernel32")]) and some .NET assemblies are
managed C++ that include the headers of the unmanaged assemblies.

Now if we deploy this framework as part of an application and all framework
files (managed and unmanaged) are installed into the same folder everything
works just fine. But if we install the managed assemblies into the Global
Assembly Cache we run into problems. The managed assemblies simply can't
find their unmanaged dependencies. This is comprehensible because it is not
clear for the runtime where the dlls are actually installed. Currently we
solved the by expanding the path variable of the application process with a
link to the directory containing the dependencies.

What is quite interesting is that NGen.exe (.NET 2.0 framework) cannot deal
with this scenario (managed dll in GAC, unmanaged dll in "C:\Program
Files\TestApp\bin" directory). I know that NGen.exe offers the switch
/AppBase to point to the directory containing the dependencies but this does
not work in our case. We call NGen.exe the following way:

"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ngen.exe" install
"ManagedTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<public key
token>" /AppBase:"C:\Program Files\TestApp\bin\\"

NGen.exe fails with the following error message:
"Failed to load dependency <unmanaged dependency> of assembly <managed
assembly>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<public key
token> because of the following error : This application has failed to start
because the application configuration is incorrect. Reinstalling the
application may fix this problem. (Exception from HRESULT: 0x800736B1)

When I add the directory (C:\Program Files\TestApp\bin") to the PATH
variable NGen works just fine. This is not very elegant because I want to
call NGen.exe in my merge module that deploys the framework. Basically the
WiX installer that creates my merge modules calls NGen just like that and it
works but only if I set the PATH variable accordingly. The attribute
AppBaseDirectory in NetFx:NativeImage is set to the correct dependencies
folder (actually the NGen.exe call is copied out of the installer log file)

I don't want my installer to manipulate the PATH variable but currently I
don't see another way. I posted in the MSDNs Common language runtime forum
because it is not clear to me why the AppBase switch is not solving that
problem.

Does anyone know what I can do in my installer besides adding the directory
to the PATH variable?

Thanks!
-- 
View this message in context: 
http://n2.nabble.com/Assemblies-in-GAC-don%27t-find-their-native-dependencies-tp1306147p1306147.html
Sent from the wix-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to