Kristofor
Kristofor

Reputation:

C# and FAXCOMEXLib

I'm using the FAXCOMEXLib api for sending faxes in C#. I've recently moved to a new development machine running Vista and now I'm running into an issue with the API. Microsoft released a new version with Vista and now when I compile the application on the Vista machine, I can't install and run it on an XP box without getting a fatal exception.

My question is, whats the best way to go about being able to compile and prepare installations on the Vista machine, but still allow the use of the application on XP? Do I have to actually have an XP box available to do a final release compile or is there a way to get around these problems?

Thanks for any help with this problem.

Upvotes: 1

Views: 1903

Answers (1)

Ganesh R.
Ganesh R.

Reputation: 4385

Not exactly an answer but may help: I got this from Experts Exchange:

After much tribulation, I found a solution.

The root cause of the problem is simple: the version of FAXCOMEXLib in Vista is different than that of XP. So, when I built the solution in Vista, it built the Interop wrapper around the newer version, that found in the system32 directory, regardless of what actual fxscomex.dll file I referenced. So, it was always wrapping around a version of the file incompatible with XP.

To work around it, I built the solution on an XP box, then stole the Interop wrapper from that build. I then wrote a batch file that I run when I copy the build onto the XP box. The batch file gets rid of the existing Interop wrapper, replaces it with the wrapper I stole from the XP build, gets rid of my assembly (called fax.dll) that references the Interop wrapper, and recompiles it from scratch on the XP box using the csc.exe tool and the original fax.cs file. In other words, I essentially beat the files into submission until they point to the right version of the FAXCOMEXLib library. For clarity, here's the batch file that converts the Vista-compatible version of the program to an XP-compatible version:

***** del Interop.FAXCOMEXLib.dll del fax.dll ren Interop.FAXCOMEXLib.dll.fix Interop.FAXCOMEXLib.dll "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc" /t:library /r:Microsoft.Practices.EnterpriseLibrary.Common.dll /r:Microsoft.Practices.EnterpriseLibrary.Data.dll /r:Interop.FAXCOMEXLib.dll /out:Fax.dll fax.cs


Not very elegent or pretty, but it does the trick.

I would imagine that this would be an issue with any old COM .dll on XP that has been updated to a new version for Vista.

Thank you cpkilekofp for taking a look. Admin, you may close this thread.

Hope this helps.

Upvotes: 2

Related Questions