PDA

View Full Version : Issue with InstallUtil.exe


Tom Whitner
11-22-2004, 05:07 PM
I am prototyping some functionality with WMI which requires that instrumented assemblies be installed using InstallUtil.exe. I am trying to use Spring to configure my installer class which is simply a class with a collection of installers where each installer in turn may have other collections or data. Each of these classes exist in the .NET framework and simply needs to be initialized and assembled before the master Install() method is called. So, here's the problem. I have everything configured and from a sample exe I have created, I can see that Spring can successfully assemble and configure my class. However, when I run InstallUtil.exe over my assembly, it states that it can not find the first object that is configured. This occurs when Spring uses Assembly.LoadWithPartialName to load the assembly. This method "Loads an assembly from the application directory or from the global assembly cache ..." Because InstallUtil is part of the .NET framework, it is not collocated with my assembly and as a result, my assembly is neither in the application directory, nor the GAC, and I don't want it in the GAC. I am not sure if this is a Spring defect, as I know .NET is very particular about where assemblies are loaded from. However, it is worth noting that InstallUtil itself can load types from my assembly under exactly the same conditions. My guess is that InstallUtil is using Assembly.LoadFile to load the assemblies it is going to install. I tried copying InstallUtil.exe (and InstallUtilLib.dll) into my assembly directory. When run from there, everything worked. I’m throwing this out there to see if anyone has any suggestions to work around this and in case anyone else is considering this approach to configuring InstallUtil.

Thanks,
Tom

Aleks Seovic
11-23-2004, 06:21 PM
Hi Tom,

I'm not sure this is Spring issue either, as the problem you are experiencing is dependent on .Net assembly resolver behavior.

I can think of two possible workarounds that might work:

1. Use DEVPATH environment variable to specify location of your assemblies. In order for this to work you need to make sure that you have following setting in your machine.config:

<runtime>
<developmentMode developerInstallation="true"/>
</runtime>

2. Add CODEBASE hints for your assemblies to InstallUtil.exe.config (probably have to create it, as it doesn't exist in clean installation)

Either way you need to make sure that you specify /AssemblyName command line switch when you run InstallUtil in order for it to treat specified assemblies as assembly names instead of file names, which should cause it to use assembly resolver.

Let me know if this helps. I know it's not perfect but it should get the job done.

Regards,

Aleks