See the top rated post in this thread. Click here

Results 1 to 4 of 4

Thread: How to avoid ambiguous reference errors between AcMgd.dll and AcCoreMgd.dll

  1. #1
    Member
    Join Date
    2013-05
    Posts
    5
    Login to Give a bone
    0

    Default How to avoid ambiguous reference errors between AcMgd.dll and AcCoreMgd.dll

    What's the rule of thumb for avoiding ambiguous reference errors between 'Autodesk.AutoCAD.ApplicationServices.Application' and 'Autodesk.AutoCAD.ApplicationServices.Core.Application' when AcMgd.dll and AcCoreMgd.dll are both referenced in a Visual Studio project, targeted for Civil3D 2014?

    Tim Sprout

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    1

    Default Re: How to avoid ambiguous reference errors between AcMgd.dll and AcCoreMgd.dll

    Quote Originally Posted by timsprout View Post
    What's the rule of thumb for avoiding ambiguous reference errors between 'Autodesk.AutoCAD.ApplicationServices.Application' and 'Autodesk.AutoCAD.ApplicationServices.Core.Application' when AcMgd.dll and AcCoreMgd.dll are both referenced in a Visual Studio project, targeted for Civil3D 2014?

    Tim Sprout
    It would be a lot easier to help if you post a code sample that's giving you an issue... But in short... To be less ambiguous, of course.

    More specifically, you'll need to either add the appropriate using/imports declarations, or use namespace qualification (not a fan personally, unless I absolutely have to).

    As a quick example (C#):

    Code:
    using Autodesk.AutoCAD.ApplicationServices;
    using Autodesk.AutoCAD.DatabaseServices;
    using Autodesk.AutoCAD.EditorInput;
    using Autodesk.AutoCAD.Geometry;
    using Autodesk.AutoCAD.Runtime;
    
    using Autodesk.Civil.ApplicationServices;
    using Autodesk.Civil.DatabaseServices;
    
    using acApp = Autodesk.AutoCAD.ApplicationServices.Application;
    
    using System;
    using System.IO;
    
    [assembly: CommandClass(typeof(FOO.BAR))]
    
    namespace FOO
    {
        public class BAR : IExtensionApplication
        {
            void IExtensionApplication.Initialize()
            {
                acApp.Idle += onIdle;
            }
            void IExtensionApplication.Terminate()
            {
            }
    
            private static DocumentCollection acDocs = acApp.DocumentManager;
    
            private static void onIdle(object sender, EventArgs e)
            {
                acApp.Idle -= onIdle;
    
                Document acDoc = acDocs.MdiActiveDocument;
                if (acDoc == null)
                    return;
    
                acDoc.Editor.WriteMessage("\n[App Event] : Idle \n");
            }
    
        // ...
    
        }
    }


    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    Member
    Join Date
    2013-05
    Posts
    5
    Login to Give a bone
    0

    Default Re: How to avoid ambiguous reference errors between AcMgd.dll and AcCoreMgd.dll

    Quote Originally Posted by BlackBox View Post
    It would be a lot easier to help if you post a code sample that's giving you an issue... But in short... To be less ambiguous, of course.

    More specifically, you'll need to either add the appropriate using/imports declarations, or use namespace qualification (not a fan personally, unless I absolutely have to).

    As a quick example (C#):

    Code:
    using Autodesk.AutoCAD.ApplicationServices;
    using Autodesk.AutoCAD.DatabaseServices;
    using Autodesk.AutoCAD.EditorInput;
    using Autodesk.AutoCAD.Geometry;
    using Autodesk.AutoCAD.Runtime;
    
    using Autodesk.Civil.ApplicationServices;
    using Autodesk.Civil.DatabaseServices;
    
    using acApp = Autodesk.AutoCAD.ApplicationServices.Application;
    
    using System;
    using System.IO;
    
    [assembly: CommandClass(typeof(FOO.BAR))]
    
    namespace FOO
    {
        public class BAR : IExtensionApplication
        {
            void IExtensionApplication.Initialize()
            {
                acApp.Idle += onIdle;
            }
            void IExtensionApplication.Terminate()
            {
            }
    
            private static DocumentCollection acDocs = acApp.DocumentManager;
    
            private static void onIdle(object sender, EventArgs e)
            {
                acApp.Idle -= onIdle;
    
                Document acDoc = acDocs.MdiActiveDocument;
                if (acDoc == null)
                    return;
    
                acDoc.Editor.WriteMessage("\n[App Event] : Idle \n");
            }
    
        // ...
    
        }
    }


    Cheers
    Thank you.

    So...don't use Using statements for both if using a method common to both. If both Using declarations are needed, use namespace qualification.

    Tim Sprout

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: How to avoid ambiguous reference errors between AcMgd.dll and AcCoreMgd.dll

    Quote Originally Posted by timsprout View Post
    Thank you.

    So...don't use Using statements for both if using a method common to both. If both Using declarations are needed, use namespace qualification.
    You're welcome, Tim; I'm happy to help.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. Replies: 4
    Last Post: 2014-09-12, 05:31 PM
  2. AutoCAD 2010 acmgd.dll dependency
    By hlusiakov580562 in forum Dot Net API
    Replies: 0
    Last Post: 2014-08-20, 09:11 AM
  3. Replies: 1
    Last Post: 2010-01-19, 10:07 AM
  4. How to avoid "duplicate type mark" errors?
    By patricks in forum Revit Architecture - Families
    Replies: 7
    Last Post: 2008-11-25, 07:15 PM
  5. Replies: 0
    Last Post: 2005-08-15, 12:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •