Migrating an existing API program to .NET 8

The migration of articy:draft X to .NET 8 with version 4.1 requires changes to all csproj-files in order for the sources to be built correctly against this new target. This also includes any API program.

The easiest way to migrate your own API programs is to create a new, empty API program project using the DevKit Tools plugin that ships with articy:draft X (see Per program project setup) and copy all your originial source and resource files into this new project. Follow the step-by-step guide below to achieve that:

  1. Use the DevKit Tools plugin to create a new, empty API project using exactly the same plugin-id (namespace) as your existing API program.

    Using this project template generator, the project will already come with th Articy.API NuGet package containing all required articy files and custom MSBuild targets for an API program.

      Note

    articy:draft 3 supplied dependencies with a separate installer. These, however, are now part of the NuGet package, which means the installer from articy:draft 3 won't work anymore.

    Please keep in mind that starting with articy:draft X all code is 64-Bit only.

    The NuGet package comes with additional dependencies to the 3rd-party libraries articy:draft X requires.

  2. Copy all your source and resource files from the API program you want to migrate into the newly create project. Don't overwrite the newly created project file (*.csproj)!

  3. Edit your Properties/AssemblyInfo.cs file and remove all assembly-versioning related entries. You can specify them in the "Packaging/General" section of your project properties or add them manually, directly into the global "PropertyGroup" of the csproj file. This might look something like:

    AssemblyInfo settings
    <AssemblyTitle>MyCompany.MyProgram</AssemblyTitle>
    <Company>Articy Software GmbH & Co. KG</Company>
    <Product>MyProduct</Product>
    <Copyright>Copyright © 2024</Copyright>

  4. Make sure that all your resource files (e.g. images) have the "Build Action" and "Copy to Output Directory" values set as required. Copying these files over from your original project will lose the information you had set there.

  5. Use the NuGet Package Manager to add required depenencies. Keep in mind that the dependencies need to target at least .NET Standard 2.0 or .NET 5 or higher to be compatible with articy:draft X 4.1.

  6. Now, a recompilation should work. Check if your dependencies are properly copied to the output directory "...\bin\Debug\net8.0-windows\win-x64\"

    If you don't see them there you should check your project file (csproj) for the following setting in the global PropertyGroup

    Copy Dependencies to output
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

  7. If your API program uses Windows Forms, add the following lines to the global PropertyGroup to your project file (csproj).

    Adding Windows Forms
    <UseWinFormsOutOfProcDesigner>False</UseWinFormsOutOfProcDesigner>
    <UseWindowsForms>true</UseWindowsForms>

  8. As part of the migration to .NET 8, we also updated some of our libaries. While updating JSON.NET should not impact your code, the Excel Library ClosedXML had some API changes. If these changes cause compilation errors, they should be easily fixable. For a guide, take a look at the ClosedXML migration guide here: ClosedXML - Migration from 0.97 to 0.100