2
Answers

DLL Problem

Sach

Sach

14y
3.9k
1
I am working on a Setup program which creates a .msi file. There is a CustomAction program associated with it which is written in C#. There are three COM object references made in this CustomAction program which are necessary in order for it to work. They are as follows. 

1. Active DS IIS Namespace Provide (C:\Windows\System32\inetsrv\adsiis.dll)
2. Windows Script Host Object Model (C:\Windows\System32\wshom.ocx)
3. NetFwTypeLib (C:\Windows\System32\FirewallAPI.dll)

As added information, following are the tasks I use these DLLs in my program for.
1. To set MIME settings for a particular file type.
2. To create a desktop shortcut to a folder.
3. To register a program as a firewall exception.

Now, here is my problem. When I rebuild the C# program and execute the CustomAction program from within Visual Studio, it works fine and I can get the above three tasks done like a charm. However, when I actually build the .msi and try to execute it and install the program on my system, it gives an error. I'm using a Japanese OS so it gives the error in Japanese so I'll try to translate the error message in to English as best as I can. The error is something like this:

File or assembly 'Interop.IISOle, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null', or one of its dependencies could not be loaded. Cannot find the file specified.

This particular error message is given because it relates to the first dll (adsiis.dll) because it is the one which contains the IISOle namespace. Similarly it gives error messages relates to all the three COM objects which I made references to from my program. Now what I can understand from this is, somehow when this code is inside the .msi file it cannot find the appropriate COM objects. I'm really confused why this happens as the Setup gives the same error when I try to install the program even on the same machine which I used to code the CustomAction. Funnily it executes flawlessly from withing Visual Studio Interface. Please do help me with this. Thanks in advance!

Note that I'm working on Windows Vista Business, but I need my Setup to be able to install on a variety of Windows OS ranging from Windows Server 2003 to Windows 7.

Answers (2)