Installutil.exe ignored .exe.config file, how can I substitute it?

Viewed 23

I am currently trying to create a service from a .exe file that is referencing several libraries, which are all neatly sorted into subfolders:

Service.exe folder:

+---config  
+---executable  
+---thirdparty_libraries
+---icons  
+---helper_libraries
+---module_libraries
¦   +---subfolder1  
¦   +---...  
¦   +---...  
+---support  
+---temp  

I have also created an ".exe.config" file within the root directory which points towards the folders and subfolders it needs to run, which works fine:

<?xml version ="1.0"?>
<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <probing privatePath="
                executable;
                support;
                helper_libraries;
                thirdparty_libraries;
                module_libraries;
                    subfolder1;
...
...
...
            "/>     </assemblyBinding>
        <generatePublisherEvidence enabled="false" />
    </runtime>
</configuration>

Again, running the executable normally works fine. But when I try to install it using the installutil.exe from the "Developer Console for VS2017" in Administrator mode, it errors out saying that "one or more assemblies cannot be found":

Exception whilst searching for the Installer in Assembly ...\Service.exe
System.Reflection.ReflectionTypeLoadException: Atleast one Type in the Assembly cannot be loaded.

Now I am assuming that it cannot find the libraries that its referencing, how can I tell installutil.exe that it should either read the .exe.config file, or just ignore the error and continue?

1 Answers

So, as it turns out, you cannot call upon assemblies inside sub-directories with a service.

All .dll files either have to be in the same directory as the service.exe, or you embed them into the service.exe itself through third-party software or other means.

Time to reorganize my entire folder structure, I suppose.

Related