Error loading file or assembly
I am working on an installer that creates an .msi file. Associated with it is the CustomAction program, which is written in C #. This CustomAction program has three COM object references that are required for it to work. They are as follows.
- Active DS IIS namespace (C: \ Windows \ System32 \ inetsrv \ adsiis.dll)
- Windows Script Host Object Model (C: \ Windows \ System32 \ wshom.ocx)
- NetFwTypeLib (C: \ Windows \ System32 \ FirewallAPI.dll)
As additional information, the following are the tasks that I use for these DLLs in my program for.
- To set MIME options for a specific file type.
- To create a desktop shortcut for a folder.
- To register a program as a firewall exception
...
Now here's my problem. When I rebuild the C # program and run the CustomAction program from Visual Studio it works great and I can complete three tasks done like a charm. However, when I actually create the .msi and try to execute it and install the program on my system, it gives an error. I am using a Japanese OS, so it gives an error in Japanese, so I will try to translate the error into English as much as possible. The error looks something like this:
*
The file or assembly 'Interop.IISOle, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null' or one of its dependencies could not be loaded. The specified file cannot be found.
*
This particular error message is listed because it refers to the first dll (adsiis.dll) because it is the one that contains the IISOle namespace. Likewise, the error messages apply to all three COM objects that I referenced from my program. Now, what I can figure out from this, anyway, when this code is inside the .msi file, it cannot find the corresponding COM objects. I am really confused why this happens when the installer gives the same error when I try to install the program even on the same computer that I used to encode the CustomAction. Ridiculously, it works flawlessly with the Visual Studio interface. Please help me with this. Thanks in advance!
Please note that I am working on Windows Vista Business, but I need my setup to install on various Windows OSs from Windows Server 2003 to Windows 7.
a source to share
Just ran into this today. Go to the Turn Windows Features On and Off section and list everything in IIS, including the IIS 6 stuff.
Make sure the "IIS Metabase and IIS 6 Configuration Compatibility" feature has been verified, found under Internet Information Services> Web Management Tools> IIS 6 Management Compatibility.
a source to share
When I reference dsiis.dll, for example, then Visual Studio places the Interop module, namely Interop.IISOle.dll, in the bin directory of my CustomAction program. You can also find the CustomAction.exe file here. It does the same process when I reference the other two COM objects; wshom.ocx and FirewallAPI.dll. But my actual installer, written using Wix, copies this CustomAction.exe file to another directory, and MSI uses this CustomAction.exe file. The problem occurs because Interop.IISOle.dll (and others) cannot be found there either. (The error message said I needed to search from the start, it seems I was stupid not to search for it but thought there might be big problems)
So this is what I did. I instructed the Wix project to copy these Interop DLLs to the same location as the CustomAction.exe which is used by the installer. This solved the problem easily.
I am completely new when it comes to Wix, plus we need to use CustomAction for 2 and 3 for some reason.
a source to share