Visual Basic .NET (.NET8 / .NET6)


Create Project

Launch Visual Studio, select [New]-[Project] from [File] menu.
From the template of [Create a new project] dialog box, select [Windows Forms App] of [Visual Basic], click the [Next] button.
From the [Configure your new project] dialog box, specify the project name and the location of the project to be created, click the [Next] button.
From the [Additional information] dialog box, select [.NET 8.0(Long-term support)] / [.NET 6.0(Long-term support)], and click the [Create] button, then the project will be created.

* The above is for Microsoft Visual Studio Professional 2022 (64-bit). Item names and commands may differ depending on the version of Visual Studio.
   For details, please refer to [Visual Studio Launch Screen].

 

Include Header File

In order to use the functions of CAN communication driver in Visual Basic .NET, CCAN.vb file is required.

Select [Project] from the menu bar of Visual Studio, and select [Add Existing Item] from the pull-down menu.
From the [Add Existing Item] dialog box, specify the CCAN.vb file, click the [Add] button, then the header file is added to the project.

You can check whether the registered header file exists from the tree view in the [Solution Explorer] window of Visual Studio.

* The above is for Microsoft Visual Studio Professional 2022 (64-bit). Item names and commands may differ depending on the version of Visual Studio.

 

Notes on building EXE applications in "Any CPU"

In general, an EXE application built with "Any CPU" specified in the [Active solution platform] item in the Visual Studio settings [Configuration Manager] window can be executed in both 64-bit environment and 32-bit OS environment.

However, when developing an EXE application that supports the .NET8 / .NET6 framework, it is necessary to be aware of the target OS.

For example, if the development PC is 64-bit OS environment, EXE applications can only be executed in a 64-bit OS environment. If you start it in a 32-bit OS environment, the following message is displayed and it cannot be executed normally.

[This app can't run on your PC. To find a version for your PC, check with the software publisher.]

There are two ways to build an EXE application that can be executed in a 32-bit OS environment.

 * If the development PC is 32-bit OS environment, specify "Any CPU" in [Active Solution Platform] and build the EXE application.
* If the development PC is 64-bit OS environment, change "Any CPU" to "x86" in [Active Solution Platform] and build the EXE application.

Reference: .NET execution environment for .NET6 or later