# Migrate .NET Framework Project to .NET 8 Platform

Use Spread.NET to develop front-ends to database applications. It gives access to multiple sheets using many types of cells and predefined sheet styles.

## Content

Spread for WinForms supports the .NET 8 platform. If you want to migrate your .NET Framework projects/solutions to the .NET 8 platform, follow the step-by-step instructions provided in this topic.

> !type=note
> **Note:** The steps outlined below are based on an example of migrating a.NET 4.8 Framework project to the.NET 8 platform.

## Step 1: Analyze portability and start upgrade process.

The portability analyzer is not yet available in Visual Studio 2022. Therefore, you can update your application using the steps given below.

1. Open the solution in Visual Studio 2022.
2. Select **Tools** \> **Command Line** \> **Developer Command Prompt**.
    ![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/vs%20tools%20tab.png)
3. Run the following command to install upgrade-assistant.

    ```csharp
    dotnet tool install -g upgrade-assistant
    ```
4. Run the following command to upgrade your solution.

    ```csharp
    upgrade-assistant upgrade <solution file path>
    ```

    For example: upgrade-assistant upgrade C:\\Users\\project\\solution\_file.sln
    Depending on the project type you are upgrading, you may also be given the option to specify different styles of upgrade before proceeding, such as:
    • **In-place project upgrade**: This option upgrades the project without creating a copy.
    • **Side-by-side project upgrade**: This option is available only for .NET Framework projects. It copies the project, upgrades the copy, and leaves the original project alone.
    ![image](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/image.76ca0e.png)
    Additionally, if you have multiple target frameworks available for upgrade, you need to select the desired target framework.
    ![image](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/image.fd3b9b.png)
    When you select the target framework, press Y to confirm and to start the upgrade.
    ![image](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/image.3771ca.png)
5. If any errors or warnings occur, review and fix them to continue.

For more information on .NET upgrade assistance, refer to [Overview of the.NET Upgrade Assistant](https://learn.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview).

## Step 2: Port your project to the .NET 8 platform.

Note that if your project's **packages.config** file does not have NuGet references, you can skip the first two steps of migrating the NuGet format to PackageReference and proceed directly to step 3 of this section.

1. In the **Solution Explorer**, right-click on **packages.config** in your project and select **Migrate Packages.config to PackageReference..**.
    ![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/packages.config.png)
2. Select **OK** in the **Migrate NuGet formats to PackageReference** dialog.
3. In the **Solution Explorer**, right-click on your Winforms project and click **Unload Project**.
    ![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/unload%20project.png)
4. Double-click on the project file to view the **.csproj** file of the project.
5. Delete the content of the **.csproj** file and make it blank.

    > !type=note
    > **Note:** Make sure that you copy the content to a text file for backup before deleting.
6. Add the following code to the blank **.csproj** file and change it to project SDK type.
    Here, the project is a Windows Forms Application project, so the is "WinExe".

    ```csharp
    <Project Sdk="Microsoft.NET.Sdk">
            <PropertyGroup>
                    <OutputType>WinExe</OutputType>
                    <TargetFramework>net8.0-windows</TargetFramework>
                    <UseWindowsForms>true</UseWindowsForms>
            </PropertyGroup>
    </Project>
    ```
7. Find the text "PackageReference" in the backup text file, copy the entire , and paste it inside the section of the **.csproj** file.

    ```csharp
    <ItemGroup>
        <PackageReference Include="GrapeCity.Spread.WinForms">
          <Version>x.x.x.x</Version>
        </PackageReference>
    </ItemGroup>
    ```

8. Add the following code to your **.csproj** file to turn off "Auto-generate assembly information".

    ```csharp
    <PropertyGroup>
        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    </PropertyGroup>
    ```

9. Right\-click on the project and select **Reload Project**.
![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/reload%20project.png)

    The final content of the **.csproj** file will look like below:

    ```csharp
    <Project Sdk="Microsoft.NET.Sdk">
    
     <PropertyGroup>
      <OutputType>WinExe</OutputType>
      <TargetFramework>net8.0-windows</TargetFramework>
      <UseWindowsForms>true</UseWindowsForms>
     </PropertyGroup>
    
     <ItemGroup>
      <PackageReference Include="GrapeCity.Spread.WinForms">
       <Version>x.x.x.x</Version>
      </PackageReference>
     </ItemGroup>
    
     <PropertyGroup>
      <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     </PropertyGroup>
    
    </Project>
    ```

## Step 3: Install the SpreadWin Nuget package

1. From the Tools tab in Visual Studio 2022 or higher versions, select **NuGet Package Manager** \> **Manage NuGet Packages for Solution**.
    ![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/manage%20nuget%20packages%20for%20solution.png)
2. Search for "Grapecity.Spread" and install the **GrapeCity.Spread.WinForms NuGet package** into your solution.
    ![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/nuget%20package.png)
3. Once installed, rebuild the solution, and verify that the project is successfully migrated to the .NET 8 platform.