使用VB.net Express 2010开发AutoCAD.net插件调试时出现很多错误的解决办法

简介:


如果你对编程和开发AutoCAD.net 插件还是新手,那么AutoCAD开发者中心最近发布的“My First AutoCAD Plug-in”系列课程绝对值得一看。这个课程面向编程零基础但想对AutoCAD进行扩展的童鞋们。你可以使用免费的Visual Studio Express版本来开发。 AutoCAD开发者中心还提供了The AutoCAD 2010-2012 .NET Wizards项目向导,帮助你来快速的创建一个AutoCAD.net插件,并且这个向导还能帮你做好在Visual Studio Express版本中启动AutoCAD进行调试的相关设置,而这在Visual Studio Express的界面中的没有的。

 

如果你使用VB.net Express 2010 并利用The AutoCAD 2010-2012 .NET Wizards创建了一个AutoCAD.net 插件,按F5启动调试时,在”即时”窗口中可能会发现很多错误。这些错误并不影响你程序的运行,但你往往需要等待好长时间才能开发调试工作。

相关的错误信息类似:

'----Immediate Window--------------------------------------

System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=AutomationName; DataItem='ToolBarCustomizeButton' (HashCode=44123454); target element is 'ToolBarToggleButton' (Name='mCustomizeButton'); target property is 'Name' (type 'String') 
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=AutomationName; DataItem='ToolBarCustomizeButton' (HashCode=44123454); target element is 'ToolBarToggleButton' (Name='mCustomizeButton'); target property is 'Name' (type 'String') 
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=AutomationName; DataItem='ToolBarCustomizeButton' (HashCode=44123454); target element is 'RibbonItemControl' (Name=''); target property is 'Name' (type 'String') 
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=AutomationName; DataItem='InfoCenterTextBox' (HashCode=52380055); target element is 'RibbonItemControl' (Name=''); target property is 'Name' (type 'String') 
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=AutomationName; DataItem='InfoCenterTextBox' (HashCode=52380055); target element is 'Button' (Name='PART_AcceptButton'); target property is 'Name' (type 'String') 
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=AutomationName; DataItem='WebServicesLoginButton' (HashCode=720995); target element is 'LoginButtonRibbonItemControl' (Name='mContainer'); target property is 'Name' (type 'String') 
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=AutomationName; DataItem='RibbonToggleButton' (HashCode=43678569); target element is 'RibbonItemControl' (Name=''); target property is 'Name' (type 'String') 
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=AutomationName; DataItem='WebServicesLoginButton' (HashCode=720995); target element is 'WebservicesLoginButtonControl' (Name='mDropDownButton'); target property is 'Name' (type 'String') 
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Autodesk.Private.Windows.ToolBars.ToolBarControl', AncestorLevel='1''. BindingExpression:Path=IsVisible; DataItem=null; target element is 'ImageControl' (Name='mImage'); target property is 'NoTarget' (type 'Object') 
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Autodesk.Private.Windows.ToolBars.ToolBarControl', AncestorLevel='1''. BindingExpression:Path=IsVisible; DataItem=null; target element is 'ImageControl' (Name='mImage'); target property is 'NoTarget' (type 'Object') 
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Autodesk.Private.Windows.ToolBars.ToolBarControl', AncestorLevel='1''. BindingExpression:Path=IsVisible; DataItem=null; target element is 'ImageControl' (Name='mImage'); target property is 'NoTarget' (type 'Object') 
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Autodesk.Private.Windows.ToolBars.ToolBarControl', AncestorLevel='1''. BindingExpression:Path=IsVisible; DataItem=null; target element is 'ImageControl' (Name='mImage'); target property is 'NoTarget' (type 'Object') 
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Autodesk.Private.Windows.ToolBars.ToolBarControl', AncestorLevel='1''.

 

解决的办法就是添加下面的 <system.diagnostics>节到 Acad.exe.Config中,这个文件可以在你的AutoCAD安装目录中找到:

    <system.diagnostics>
    <sources>                                                                                                                                                                                      
      <source name="System.Windows.Data"               
              switchName="SourceSwitch">
        <listeners>
          <remove name="Default" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

添加完成后,类似下面的样子(这里我使用的是Civil 3D):

<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0"/>
    </startup>
    <!--All assemblies in AutoCAD are fully trusted         
so there's no point generating publisher evidence--> <runtime> <generatePublisherEvidence enabled="false"/> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatePath="bin\FDO;bin;Plugins\Workflow\Activities"/> </assemblyBinding> </runtime> <system.diagnostics> <sources> <source name="System.Windows.Data" switchName="SourceSwitch"> <listeners> <remove name="Default" /> </listeners> </source> </sources> </system.diagnostics> </configuration>

希望对你有帮助。

作者: 峻祁连
邮箱:junqilian@163.com 
出处: http://junqilian.cnblogs.com 
转载请保留此信息。




本文转自峻祁连. Moving to Cloud/Mobile博客园博客,原文链接:http://www.cnblogs.com/junqilian/archive/2012/03/21/2409542.html ,如需转载请自行联系原作者
相关文章
|
11天前
|
开发框架 算法 Java
.NET 开发:实现高效能的秘诀
【7月更文挑战第4天】探索.NET高效开发涉及理解运行时(如GC、JIT)、代码与算法优化及工具利用。关键点包括适应性垃圾回收、异步编程、明智的并发控制;编写高效代码(避免对象创建,选对数据结构和算法);使用性能分析工具,善用高性能框架如ASP.NET Core,并借助云服务和CI/CD流程持续优化。性能优化是持续学习与实践的过程。
21 1
|
1月前
|
开发框架 前端开发 .NET
LIMS(实验室)信息管理系统源码、有哪些应用领域?采用C# ASP.NET dotnet 3.5 开发的一套实验室信息系统源码
集成于VS 2019,EXT.NET前端和ASP.NET后端,搭配MSSQL 2018数据库。系统覆盖样品管理、数据分析、报表和项目管理等实验室全流程。应用广泛,包括生产质检(如石化、制药)、环保监测、试验研究等领域。随着技术发展,现代LIMS还融合了临床、电子实验室笔记本和SaaS等功能,以满足复杂多样的实验室管理需求。
36 3
LIMS(实验室)信息管理系统源码、有哪些应用领域?采用C# ASP.NET dotnet 3.5 开发的一套实验室信息系统源码
|
11天前
|
人工智能 前端开发 Devops
NET技术在现代开发中的影响力日益增强,本文聚焦其核心价值,如多语言支持、强大的Visual Studio工具、丰富的类库和跨平台能力。
【7月更文挑战第4天】**.NET技术在现代开发中的影响力日益增强,本文聚焦其核心价值,如多语言支持、强大的Visual Studio工具、丰富的类库和跨平台能力。实际应用涵盖企业系统、Web、移动和游戏开发,以及云服务。面对性能挑战、容器化、AI集成及跨平台竞争,.NET持续创新,开发者应关注技术趋势,提升技能,并参与社区,共同推进技术发展。**
11 1
|
11天前
|
机器学习/深度学习 人工智能 开发者
.NET 技术:为开发带来新机遇
【7月更文挑战第4天】**.NET技术开启软件开发新篇章,通过跨平台革命(.NET Core, Xamarin, .NET MAUI)、云服务与微服务(Azure, DevOps, Docker)及AI集成(ML.NET, 认知服务, TensorFlow)为开发者创造新机遇。开源社区的繁荣与性能提升使.NET更具竞争力,推动智能应用的创新与发展。开发者需紧跟潮流,利用这些工具和框架构建高效、创新的解决方案。**
8 1
|
17天前
|
JSON 开发框架 API
【推荐100个unity插件之20】一个强大的JSON处理库——Newtonsoft.Json(也称为Json.NET)
【推荐100个unity插件之20】一个强大的JSON处理库——Newtonsoft.Json(也称为Json.NET)
27 0
|
1月前
|
开发框架 JavaScript 前端开发
分享7个.NET开源、功能强大的快速开发框架
分享7个.NET开源、功能强大的快速开发框架
|
2月前
|
开发框架 JavaScript 中间件
node+express搭建服务器环境
node+express搭建服务器环境
node+express搭建服务器环境
|
7天前
|
开发框架 监控 JavaScript
使用Node.js 框架( Express.js)来创建一个简单的 API 端点
【7月更文挑战第5天】使用Node.js 框架( Express.js)来创建一个简单的 API 端点
11 3
|
17天前
|
JSON JavaScript 中间件
Express.js:构建轻量级Node.js应用的基石
**Express.js 概览**:作为Node.js首选Web框架,Express以其轻量、灵活和强大的特性深受喜爱。自2009年以来,其简洁设计和丰富中间件支持引领开发者构建定制化应用。快速开始:使用`express-generator`创建项目,安装依赖,启动应用。示例展示如何添加返回JSON消息的GET路由。Express适用于RESTful API、实时应用等多种场景,社区支持广泛,助力高效开发。
18 1
|
1月前
|
JavaScript 前端开发 中间件
Express框架搭建项目 node.js
【6月更文挑战第3天】这篇文章是关于使用Express框架构建Node.js Web应用的教程。Express是一个轻量级、功能丰富的框架,特点包括简洁灵活的核心、强大的中间件支持、灵活的路由系统和模板引擎兼容性。文章介绍了如何安装Express,并通过一个简单的示例展示了如何创建一个基本的Web服务器。最后,鼓励读者继续学习和实践,以充分利用Express和Node.js的能力。
40 1