CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ObjectARX 开发指南

编译和调试混合模式项目

2023-1-1 07:38| 发布者: admin| 查看: 300| 评论: 0|来自: AutoCAD

您必须使用Microsoft® Visual Studio® 2019编译 ObjectARX 应用程序,以便在AutoCAD 2021 中使用。AutoCAD 2021面向 .NET Framework4.8,这是Microsoft® Visual Studio® 2019 中新项目的默认目标。

可以在安装了适当编译器的早期版本中支持程序。下面提到了为 AutoCAD 产品的早期版本编译程序所需的开发环境:

  • 对于AutoCAD 2019和AutoCAD 2020,您应该使用Microsoft Visual Studio 2017和Update 2
  • 对于AutoCAD 2018,您应该使用Microsoft Visual Studio 2015和Update 3
  • 对于 AutoCAD 2017,您应该使用 Microsoft Visual Studio 2015 和 Update 1
  • 对于 AutoCAD 2015 和 2016,您应该使用 Microsoft Visual Studio 2012 和 Update 4

在许多情况下,可以使用单个开发环境维护单个项目并面向多个编译器。

若要使用 Microsoft Visual Studio 2019 在早期 AutoCAD 版本中生成和调试项目,可能还需要更改项目的目标 .NET Framework 和 Platform 工具集。使用 Microsoft Visual Studio 2019 面向不同的 .NET Framework 需要根据目标版本安装以下内容:

  • Microsoft Visual Studio 2017 with Update 2 和 .NET Framework 4.7
  • Microsoft Visual Studio 2015 with Update 3 和 .NET Framework 4.6
  • Microsoft Visual Studio 2012 with Update 4 和 .NET Framework 4.5

下面说明了如何更改 Microsoft Visual Studio 2019 项目的目标 .NET Framework 和平台工具集,以编译项目以用于 AutoCAD 2015 到 AutoCAD 2020:

  1. 迁移 Microsoft Visual Studio 2012/2015/2017 项目或在 Microsoft Visual Studio 2019 中创建新项目。
  2. 在 Microsoft Visual Studio 中,单击“项目”菜单“属性”。
  3. 在“属性页”对话框的“配置”下拉列表中,选择要编辑的配置。
  4. 在“属性”树的左侧,展开“配置属性”,然后选择“常规”。
  5. 在“属性”窗格的右侧“常规”类别下,选择“平台工具集”,然后选择以下值之一:
    • v110以 AutoCAD 2015 或 AutoCAD 2016 为目标
    • v140以 AutoCAD 2017 或 AutoCAD 2018 为目标
    • v141以 AutoCAD 2019 或 AutoCAD 2020 为目标
  6. 单击“确定”。
  7. 接下来,关闭 Microsoft Visual Studio 中的解决方案/项目。单击“文件”菜单“关闭解决方案”。
  8. 在 Windows 资源管理器或文件资源管理器中,浏览到项目的位置。
  9. 找到扩展名为 .vcsproj 的文件。

    例如,如果项目名称为 AdskCustomPalette,则该文件将命名为 AdskCustomPalette.vcsproj。项目名称可能与解决方案不同。

  10. 右键单击扩展名为 .vcsproj 的文件。单击“使用记事本打开”。

    如果需要,请按住 Shift 键,然后右键单击。单击打开方式,然后选择程序。在“打开方式”对话框中,选择“记事本”,然后单击“确定”。

  11. 找到“属性组”元素。
  12. 将 TargetFrameworkVersion 属性的 v4.8 值更改为以下值之一:
    • v4.5以 AutoCAD 2015 或 AutoCAD 2016 为目标
    • v4.6以 AutoCAD 2017 或 AutoCAD 2018 为目标
    • v4.7以 AutoCAD 2019 或 AutoCAD 2020 为目标

    该属性现在应如下所示。<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

    注意:如果需要使用 .NET Framework 3.5 Client 或 .NET Framework 4.0 Client,请添加到“PropertyGroup”元素。<TargetFrameworkProfile>Client</TargetFrameworkProfile>
  13. 在记事本中,单击“文件”菜单>“保存”。关闭记事本。
  14. 在 Microsoft Visual Studio 中重新打开该项目。
  15. 像使用 Microsoft Visual Studio 一样构建/调试项目。
注意:如果要从 Microsoft Visual Studio 2015 调试 AutoCAD 2015 或 AutoCAD 2016 中的应用程序,则不必将 TargetFrameworkVersion 属性更改回 v4.5。对于AutoCAD 2017和AutoCAD 2018,您必须使用Microsoft Visual Studio 2015,.NET版本应为4.6。

有关多目标项目的其他信息,请访问以下 URL:


路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 14:38

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部