GstarCAD 2027 .NET Upgrade Guide

Contents

9146bf5d78a181ea27dc053f

Introduction

This document illustrates how to upgrade and adapt the .NET project/application from old versions.

Programming Environment

  • Microsoft® Visual Studio 2022 (version 17.8.0)

  • Windows SDK 10.0 (latest installed version)

  • CPU:

Basic: 1.6 GHz CPU

Recommended: 3.0 GHz CPU and above

  • RAM:

Basic: 2 GB

Recommended: 8 GB and above

  • Operation System (OS)

Windows 11

Windows 10 (version 1507 and above):

Home, Professional, Education and Enterprise (not support LTSC and Windows 10 S)

  • Monitor Resolution:

1028x800 and above true color display, including 4K (3840x2160) display

  • GRXSDK

  • Microsoft .NET 8.0

Install SDK

Download SDK.

Unzip GRXSDK.ZIP file to the local disk (e.g. 'C:\grxsdk') and there will be 5 directories generated (in 'C:\grxsdk') which are: arx, inc, inc-x64, lib-x64 and utils.

arx contains the header files, library files and sample programs used for porting ARX programs to GRX programs. It contains the following directories:

  • Inc: Header files used for porting from ARX to GRX

  • inc-x64: Files used by COM and .NET (for 64-bit)

  • lib-x64: GRX libraries (for 64-bit)

  • Samples: Sample projects, including Dotnet, fact_dg, HelloADS, HelloARX and SimplePalette.

  • Dotnet: .NET programming samples

  1. Addline: .NET programming sample of adding solid lines

  2. Hello: .NET programming sample of outputting prompt information

  3. Vbhello: Sample of .NET programming with VB .NET

  • fact_dg: Sample of LISP function definition

  • HelloADS: Sample of ADS programming

  • HelloARX: Sample of GRX programming

  • SimplePalette: Programming sample of how to create a set Palette windows

  • Utils: Directory contains sub-directories of GRX extended applications, including APIs for extended function development, e.g. BREP for boundary representation.

Inc: Header files used for programming the GRX

inc-x64: Files used by COM and .NET (for 64-bit)

lib-x64: GRX libraries (for 64-bit)

Utils: Directory contains subdirectories of GRX extended applications, including APIs for extended function development, e.g. BREP for boundary representation.

Visual Studio 2022 C# .NET Program Upgrade Process

The following illustrates the upgrade process by taking the 'Hello' project as an example, and assumes that the SDK is installed in 'C:\grxsdk'.

Upgrade Project File

Open C# Project File

In Microsoft Visual Studio 2022, Click the File menu and select the Open submenu, then select Open a Project/Solution…, and select the C# project file to be upgraded in the dialog box.

21ff4510d5339013ccc732ce

Upgrade Project File (2)

Step 1: In the Solution Explorer of Visual Studio 2022, right-click the project 'Hello', and select the Upgrade.

cc8feaeb59d35857c3f05c36

Step 2: Select 'In-place project upgrade' from Upgrade project to a newer .NET version drop-down list.

948165e03732e41f595ed0e5

Step 3: Select .Net 8.0 and click Next.

c8bf3181b7a573eb13949310

Step 4: Click Upgrade selection button.

d7889c20db18d5a330cc4142

Step 5: When the output window shows success, the upgrade is complete.

f714352bcbd3ff223b26218a
Note

The upgrade will modify the original csproj file. It is recommended to back up the lower version project file before upgrading.

Change Reference File

Add Referenced File

In Solution Explorer of Visual Studio 2022, right-click on project 'Hello' and select Add Reference. After the Reference Manager dialog window pops out, click Browse… button as shown below.

6ef06d3083ded9bd5b86ac9c af3d3bb044dfb6c84d14e03b

Load Reference File

From the installation path of SDK, e.g. 'C:\grxsdk', select 'GcCoreMgd.dll', 'GcDbMgd.dll' and 'GcMgd.dll' in '\arx\inc' and 'GrxCAD.Interop.dll'(or 'acax.tlb') in '\arx\inc-x64', and add them by clicking Add button.

bbf7b7992bcd1f624d73b371 6cff93825a8345224f178a6a 3310d124e818d61fd5f46350
NOTE

'GcCoreMgd.dll', 'GcDbMgd.dll' and 'GcMgd.dll' must be added while 'GrxCAD.Interop.dll' (or 'acax.tlb') is optional (needed when COM is used in the program).

After adding the files, right-click added 'GcCoreMgd.dll', 'GcDbMgd.dll' and 'GcMgd.dll' files one by one and select Properties at the context menu, the Reference Properties palette pops up. Set the value of Copy Local property to False. The following screenshot shows how to change Copy Local property of 'GcCoreMgd.dll'.

3296f5e58d958156607d0909 31adc5c8e82b07f5ad9a0927

Modify Project File

Before compiling the project, you need to add the following to the ItemGroup element of the CSPROJ file , as follows :

<ItemGroup>
<FrameworkReference Include="Microsoft.WindowsDesktop.App">
</FrameworkReference>
</ItemGroup>

Compile Program

In Visual Studio 2022, click Build→Build Solution to regenerate the DLL file in corresponding directory. Run CAD and input 'netload' at command line, select the relative DLL file from Select .Net Assembly dialog window and click Open button to load it.

Visual Studio 2022 VB .NET Program Upgrade Process

The following illustrates the upgrade process by taking the 'vbHello' project as an example, and assumes that the SDK is installed in 'C:\grxsdk'.

Upgrade Project File (3)

Open VB Project File

In Microsoft Visual Studio 2022, Click the File menu and select the Open submenu, then select Open a Project/Solution…, and select the VB project file to be upgraded in the dialog box.

3061a1132824e602d794fd88

Upgrade Project File (4)

In the Solution Explorer of Visual Studio 2022, select the project name 'vbHello', right-click, and select the [Upgrade] menu item.

bfa2dca7e8650c151ed3de2d

The following upgrade steps are the same as the C# upgrade steps:

271762736eda7c6af99c7a98 87a2784bd1bebff7807973e9 03b5c56e0277d62b3be9c550 92bee4de242dda49c0b7014b
Note

The upgrade will modify the original vbproj file. It is recommended to back up the lower version project file before upgrading.

Change Reference File (2)

Add Referenced File (2)

In Solution Explorer of Visual Studio 2022, right-click on project 'vbHello' and select Add Reference. After the Reference Manager dialog window pops out, click Browse… button as shown below.

bbaffeb09d208080b6c19d8b

Load Reference File (2)

From the installation path of SDK, e.g. 'C:\grxsdk', select 'GcCoreMgd.dll', 'GcDbMgd.dll' and 'GcMgd.dll' in '\arx\inc' and 'GrxCAD.Interop.dll' or 'acax.tlb' in '\arx\inc-x64', and add them by clicking Add button.

8c26a15d6aee277f02dd4798 f2086b963b35492d8239c177 013ca76641d32bf99012c947
NOTE

'GcCoreMgd.dll', 'GcDbMgd.dll' and 'GcMgd.dll' must be added while 'GrxCAD.Interop.dll' (or 'acax.tlb') is optional (needed when COM is used in the program).

After adding the files, right-click added 'GcCoreMgd.dll', 'GcDbMgd.dll' and 'GcMgd.dll' files one by one and select Properties at the context menu, the Reference Properties palette pops up. Set the value of Copy Local property to False. The following screenshot shows how to change Copy Local property of 'GcCoreMgd.dll'.

4fecc732444bc56f45f582cd 503482312f305f06859f382f

Modify Project Files

Before compiling the project, you need to add the following to the ItemGroup element of the VBPROJ file, as follows:

<ItemGroup>
<FrameworkReference Include="Microsoft.WindowsDesktop.App">
</FrameworkReference>
</ItemGroup>

Compile Program (2)

In Visual Studio 2022, click Build→Build Solution to regenerate the DLL file in corresponding directory. Run CAD and input 'netload' at command line, select the relative DLL file from Select .Net Assembly dialog window and click Open button to load it.

Copyright reserved: Gstarsoft Co.,Ltd

Copying and referencing any part of this document is allowed. No part of this document may be changed without permission. Please keep this statement when copying or referencing this document.

02cd8e2b8ba0bc4c0487d927