Porting an existing project to .NET Core 2.0

From GTA Network Wiki
Jump to: navigation, search

Porting an existing project to .NET Core 2.0


Porting an existing project from .NET Framework to .NET Core for the API NuGet package compatibility is easy and can be done with the following instructions covered in this page.

Setting up Development Environment

Visual Studio

Before we start, make sure to have installed the .NET Core cross-platform development package from the Visual Studio Installer


Visual Studio Code

In order for Visual Studio Code to recognise .NET Core 2.0, it is required to install its SDK which can be done so from here


Porting instructions

0- Make sure to have closed your solution.

1- Navigate to your project folder, you should be able to see your .csproj file.

2- Backup the .csproj. (optionally)

3- Edit the .csproj file using any text editor program.

4- Select everything either with the cursor or by pressing the CTRL+A combination and delete everything.

5- Copy and paste the following lines into the recently emptied window.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

6- Save the file and open your solution with your desired IDE.

Installing the API Package:

Visual Studio

1- Navigate to Tools > NuGet Package Manager > Package Manager Console.

2- Copy & Paste the following line into the console: Install-Package gtanetwork.api

Visual Studio Code

In order to open the Terminal (aka Console) in Visual Studio Code, we either use a quick combination that is Ctrl+` or by navigating the menu

1- Navigate to View > Integrated Terminal.

2- Copy & Paste the following line into the console: dotnet add package gtanetwork.api