FAXCOMLib错误(c#)

时间:2013-12-08 18:40:08

标签: c#

我写了一个小程序,使用FAXCOMLIB发送传真。

我创建了一个“传真”类,这里是代码:

    internal class Fax
    {

        public  void SendFax( string FileName, string FaxNumber)
        {
            if (FaxNumber != "")
            {
                try
                {
                    FAXCOMLib.FaxServer faxServer = new FAXCOMLib.FaxServerClass();
                    faxServer.Connect(Environment.MachineName);


                    FAXCOMLib.FaxDoc faxDoc = (FAXCOMLib.FaxDoc)faxServer.CreateDocument(FileName);

                    faxDoc.RecipientName = "گیرنده";
                    faxDoc.FaxNumber = FaxNumber;

                    faxDoc.DisplayName = "Asa";


                    int Response = faxDoc.Send();


                    faxServer.Disconnect();

                }
                catch (Exception Ex) { MessageBox.Show(Ex.Message); }
            }
        }
    }

因此,当我想执行代码时,我遇到了这些错误:

1-Error 13  Interop type 'FAXCOMLib.FaxServerClass' cannot be embedded. Use the applicable interface instead

2-Error 12  The type 'FAXCOMLib.FaxServerClass' has no constructors defined 

1 个答案:

答案 0 :(得分:1)

在您的项目引用中,展开它并选择有问题的程序集(无论名称是什么...... FAX ......无论如何),然后右键单击它并转到属性。在那里,您将看到“嵌入互操作类型”属性 - 将其更改为“False”