开发者

Assembly not referenced error with Interactive Brokes ActiveX API

开发者 https://www.devze.com 2022-12-30 11:40 出处:网络
I\'m attempting to use the Interactive Brokers ActiveX API, but I\'m having a little trouble: error CS0012: The type

I'm attempting to use the Interactive Brokers ActiveX API, but I'm having a little trouble:

error CS0012: The type 'System.Windows.Forms.AxHost' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

My code:

namespace DataFeed.Gateway
{
    class IBGateway : IGateway
    {
        private AxTWSLib.AxTws tws; //<-- the error line
        //...
    }
}

I have a c开发者_StackOverflow社区onsole application, so I'm wondering if that might be the reason why ActiveX is not working... or is there something else going on here? Maybe I should add the AxTWSlib.dll to the GAC, but do I really have to? If I add the dll as a resource, then I thought that I don't need to add it to the GAC.

Note: I've dropped the AxTWSlib.dll in my project folder and I've added it to the project references... no problems there.


Sorry, it should have been completely obvious from the beginning when I read the error:

You must add a reference to assembly 'System.Windows.Forms'

An the Interactive Brokers ActiveX API requires that application has references to the System.Windows.Forms dll and a console application does not include the references. I added the references manually and now it works fine. Alternately you can create a Windows Forms Application and it should work fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消