Compile and Debug Mixed-mode Projects

You must use Microsoft® Visual Studio® 2019 to compile ObjectARX applications for use in AutoCAD 2021. AutoCAD 2021 targets the .NET Framework 4.8, which is the default target for new projects in Microsoft® Visual Studio® 2019.

It is possible to support programs in earlier releases with the appropriate compilers installed. The following mentions the development environments needed to compile programs for earlier releases of the AutoCAD product:

In many cases, it is possible to maintain a single project and target a multiple compilers using a single development environment.

To use Microsoft Visual Studio 2019 to build and debug projects in an earlier AutoCAD release, you may need to also change the target .NET Framework and Platform Toolset for your projects. Targeting a different .NET Framework with Microsoft Visual Studio 2019 requires you to install the following based on which release you are targeting:

The following explains how to change the target .NET Framework and Platform Toolset for a Microsoft Visual Studio 2019 project to compile a project for use with AutoCAD 2015 through AutoCAD 2020:

  1. Migrate your Microsoft Visual Studio 2012/2015/2017 project or create a new project in Microsoft Visual Studio 2019.
  2. In Microsoft Visual Studio, click Project menu Properties.
  3. In the Property Pages dialog box, Configuration drop-down list, choose a configuration to edit.
  4. In the Properties tree, on the left, expand Configuration Properties and select General.
  5. In the Properties pane, on the right, under the General category, select Platform Toolset and choose one of the following values:
    • v110 to target AutoCAD 2015 or AutoCAD 2016
    • v140 to target AutoCAD 2017 or AutoCAD 2018
    • v141 to target AutoCAD 2019 or AutoCAD 2020
  6. Click OK.
  7. Next, close the solution/project in Microsoft Visual Studio. Click File menu Close Solution.
  8. In Windows Explorer or File Explorer, browse to the location of your project.
  9. Locate the file with the extension .vcsproj.

    For example, the file would be named AdskCustomPalette.vcsproj if the project name was AdskCustomPalette. The project name might not be the same as the solution.

  10. Right-click the file with the extension .vcsproj. Click Open with Notepad.

    If needed, hold Shift and then right-click. Click Open With and then Choose Program. In the Open With dialog box, select Notepad and click OK.

  11. Locate the ‘PropertyGroup’ element.
  12. Change the value of v4.8 for the TargetFrameworkVersion attribute to one of the following values:
    • v4.5 to target AutoCAD 2015 or AutoCAD 2016
    • v4.6 to target AutoCAD 2017 or AutoCAD 2018
    • v4.7 to target AutoCAD 2019 or AutoCAD 2020

    The attribute should now look like <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>.

    Note: If you need to use .NET Framework 3.5 Client or .NET Framework 4.0 Client, add <TargetFrameworkProfile>Client</TargetFrameworkProfile> to the ‘PropertyGroup’ element.
  13. In Notepad, click File menu > Save. Close Notepad.
  14. Reopen the project in Microsoft Visual Studio.
  15. Build/debug the project as you would with Microsoft Visual Studio.
Note: You should not have to change the TargetFrameworkVersion attribute back to v4.5 when you want to debug an application in AutoCAD 2015 or AutoCAD 2016 from Microsoft Visual Studio 2015. For AutoCAD 2017 and AutoCAD 2018, you have to use Microsoft Visual Studio 2015 and .NET version should be 4.6.

Additional information on multi-target projects can be found at the following URLs: