none
VISA COM 3.0 Type Library can not be used in .NET Framework 4.5 RRS feed

  • Question

  • Hi Friends:

    When wrote my code I used a DLL file named VisaComLib.dll from NI. I used two classes, the first one is "Ivi.Visa.Interop.ResourceManagerClass",the second is "Ivi.Visa.Interop.FormattedIO488Class", namespace is "using Ivi.Visa".

    My problems is that the code rans well when I used .NET Framework 3.5(please see the picture blow)

    But when I exchanged the framework from .NET3.5 to .NET4.5, the classes can not be used(plesae see blow picture)

    The programe of IVI.Visa.Interop.ResourceManagerClass is like blow code:

    #region 程序集 Ivi.Visa.Interop.dll, v5.0.0.0
    // C:\Program Files\IVI Foundation\VISA\VisaCom\Primary Interop Assemblies\Ivi.Visa.Interop.dll
    #endregion
    using System;
    using System.Runtime.InteropServices;
    namespace Ivi.Visa.Interop
    {
        [ClassInterface(0)]
        [Guid("DB8CBF1C-D6D3-11D4-AA51-00A024EE30BD")]
        [TypeLibType(2)]
        public class ResourceManagerClass : IResourceManager3, ResourceManager, IResourceManager
        {
            public ResourceManagerClass();
            [DispId(1610678275)]
            public virtual int ComponentVersion { get; }
            [DispId(1610678274)]
            public virtual string Description { get; }
            public virtual int IResourceManager_ComponentVersion { get; }
            public virtual string IResourceManager_Description { get; }
            public virtual string IResourceManager_ProgID { get; }
            public virtual short IResourceManager_SoftwareManufacturerID { get; }
            public virtual string IResourceManager_SoftwareManufacturerName { get; }
            public virtual int IResourceManager_SpecVersion { get; }
            [DispId(1610678276)]
            public virtual string ProgID { get; }
            [DispId(1610678273)]
            public virtual short SoftwareManufacturerID { get; }
            [DispId(1610678272)]
            public virtual string SoftwareManufacturerName { get; }
            [DispId(1610678277)]
            public virtual int SpecVersion { get; }
            public virtual string[] FindRsrc(string expr);
            public virtual string[] IResourceManager_FindRsrc(string expr);
            public virtual IVisaSession IResourceManager_Open(string ResourceName, AccessMode mode = AccessMode.NO_LOCK, int openTimeout = 2000, string OptionString = "");
            public virtual void IResourceManager_ParseRsrc(string ResourceName, ref short pInterfaceType, ref short pInterfaceNumber, ref string pSessionType);
            public virtual IVisaSession Open(string ResourceName, AccessMode mode = AccessMode.NO_LOCK, int openTimeout = 2000, string OptionString = "");
            public virtual void ParseRsrc(string ResourceName, ref short pInterfaceType, ref short pInterfaceNumber, ref string pSessionType);
            public virtual void ParseRsrcEx(string ResourceName, ref short pInterfaceType, ref short pInterfaceNumber, ref string pSessionType, ref string pUnaliasedExpandedResourceName, ref string pAliasIfExists);
        }
    }

    I want to use the two classes in .NET Framework  4.5 , how should I do?

    Please help me, thank you so much.

    Best Regards

    Daniel

    Tuesday, January 6, 2015 7:16 AM

Answers

  • Hi Friend:

    Thank you for your reply. I have soved this problem.

    I set the Embedded Interop Types at false then it worked.

    Thank you once more

    Best Regards

    Daneil

    • Marked as answer by Daniel_CM Thursday, January 8, 2015 5:24 AM
    Thursday, January 8, 2015 5:24 AM

All replies

  • Hello Daniel,

    >> I want to use the two classes in .NET Framework  4.5 , how should I do?

    I am wondering if the VISA COM 3.0 Type is supported in .NET Framework 4.5 since from 3.5 to 4.5, the CLR version is changed. Please have a try with .NET Framework 4.0 to see if it works.

    By the way, since this issue is related with Ivi.Visa.Interop dlls, please post it to the Ivi.Visa.Interop dll related forum:

    http://forums.ni.com/t5/Measurement-Studio-for-NET/bd-p/232

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Daniel_CM Thursday, January 8, 2015 5:24 AM
    • Unmarked as answer by Daniel_CM Thursday, January 8, 2015 5:24 AM
    Wednesday, January 7, 2015 8:09 AM
    Moderator
  • Hi Friend:

    Thank you for your reply. I have soved this problem.

    I set the Embedded Interop Types at false then it worked.

    Thank you once more

    Best Regards

    Daneil

    • Marked as answer by Daniel_CM Thursday, January 8, 2015 5:24 AM
    Thursday, January 8, 2015 5:24 AM