Originally Posted by
timsprout
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