views:

38

answers:

2

I am new to .net and have this problem: I want to make installer for application that uses avi wrapper described here. That library depends on avifil32.dll as I've found out in the source which contains

[DllImport("avifil32.dll", PreserveSig=true)].

I've made setup project in visual studio 2008 and installer is working fine on some machines. But, there is one machine that doesn't work and it breaks exactly at the part related to .avi exporting so I assumed the reason has something with this external dependency. How should I make installer to include this (or in general any) external dll if it is missing on a target machine?

+1  A: 

Can you just right click on the Primary Output in you setup project then Right Click on the Application Folder, Select Add Assembly and browse to your dll?

If you then right click the Assembly you may need to set the Register settings to register the dll on install.

Here is an article that may help.

TooFat
I am unable to add it as a reference cause it says it is not a valid assemply or com dll but I can add in setup project. I will try and get back
draganstankovic
A: 

Thanks TooFat for your advice. It helped me to realize that my previous guess about missing avifil32.dll was wrong.

The actual cause of my problem was the fact that I was using the aviwrapper library to export bitmaps to both avi and mpeg (I modified the library a little bit to be able to switch between regular and xvid codec). It worked on my desktop computer and laptop because there I already had xvid codec installed but on a virtual machine with clean Windows XP it didn't work (xvid codec was missing). I realized this by looking at the log file. What was actually happening is that my method tried to export to .mpg first and then received the exception at avi compress (because of xvid). After that it tries to export to .avi but this previous attempt messed something up and export to .avi throws exception on file open (both exports use the same temporary file name and that is why it threw exception on file open).

After I commented out .mpg export everything worked just fine and I didn't had to include the above mentioned dll.

Again thank you for your reply.

draganstankovic