我写了一段代码,直接打开autocad2010,加载生成的dll文件可以,但是debugging的时候就出现错误了,各位高手帮我看看
代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD .Runtime ;
using Autodesk.AutoCAD .DatabaseServices ;[assembly:CommandClass (typeof (MyFirstProject .Class1 ))]namespace MyFirstProject
{
public class Class1
{
[CommandMethod("AdskGreeting")]
public void AdskGreeting()
{
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDB = acDoc.Database; using (Transaction acTrans = acCurDB.TransactionManager.StartTransaction())
{
BlockTable acBlkTbl;
acBlkTbl = acTrans.GetObject (acCurDB.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord acBlkTblRec;
acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
MText objText = new MText();
objText .SetDatabaseDefaults ();
objText.Location = new Autodesk.AutoCAD.Geometry.Point3d(10, 10, 0);
objText.Contents = "Greetings, Welcome to the AutoCAD .NET Developer's Guide";
objText.TextStyleId = acCurDB.Textstyle;
acBlkTblRec.AppendEntity(objText);
acTrans.AddNewlyCreatedDBObject(objText, true);
acTrans.Commit(); }
}
}
}错误信息:
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。************** 异常文本 **************
System.Windows.Markup.XamlParseException: 调用的目标发生了异常。 标记文件“AcWindows;component/AppFrame/AcAppFrame.xaml”中对象“System.Windows.Data.Binding”处的错误。 ---> System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.InvalidProgramException: 公共语言运行时检测到无效的程序。
在 Autodesk.AutoCAD.ApplicationServices.Application.get_UIBindings()
代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD .Runtime ;
using Autodesk.AutoCAD .DatabaseServices ;[assembly:CommandClass (typeof (MyFirstProject .Class1 ))]namespace MyFirstProject
{
public class Class1
{
[CommandMethod("AdskGreeting")]
public void AdskGreeting()
{
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDB = acDoc.Database; using (Transaction acTrans = acCurDB.TransactionManager.StartTransaction())
{
BlockTable acBlkTbl;
acBlkTbl = acTrans.GetObject (acCurDB.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord acBlkTblRec;
acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
MText objText = new MText();
objText .SetDatabaseDefaults ();
objText.Location = new Autodesk.AutoCAD.Geometry.Point3d(10, 10, 0);
objText.Contents = "Greetings, Welcome to the AutoCAD .NET Developer's Guide";
objText.TextStyleId = acCurDB.Textstyle;
acBlkTblRec.AppendEntity(objText);
acTrans.AddNewlyCreatedDBObject(objText, true);
acTrans.Commit(); }
}
}
}错误信息:
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。************** 异常文本 **************
System.Windows.Markup.XamlParseException: 调用的目标发生了异常。 标记文件“AcWindows;component/AppFrame/AcAppFrame.xaml”中对象“System.Windows.Data.Binding”处的错误。 ---> System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.InvalidProgramException: 公共语言运行时检测到无效的程序。
在 Autodesk.AutoCAD.ApplicationServices.Application.get_UIBindings()
我装arx2010到vs2008上怎么vs2008就不能启动了?
1。把运行目录下的acdbmgd.dll 和 acmgb.dll删除,
2。取消引用性质中的拷贝到本地。