Add a third-party library to the Visual Studio Code project

Add a third-party .NET library by editing the
CSPROJ
project file.
Prerequisites
Set Visual Studio Code as the default external code editor. See Set the default code editor.
  1. To add a third-party library to the Visual Studio Code project
  2. Copy the .NET assembly for the library to the
    ProjectFiles/NetSolution
    project folder.
  3. From the main toolbar, select
    Open .NET Solution
    .
    The default external code editor opens.
    TIP: Rockwell Automation recommends using Microsoft Visual Studio 2022 or Microsoft Visual Studio Code as the default code editor. Some development assistance features may not be available when using a different code editor.
  4. In Visual Studio Code, open the
    CSPROJ
    project file.
  5. Add the following
    <Reference>
    element as a child of the
    <ItemGroup>
    element.
    <Reference Include="
    library
    "> <HintPath>
    path
    </HintPath> <Private>False</Private> </Reference>
    library
    The library that you want to add. For example:
    MyLibrary
    path
    The path to the library from 1. For example:
    ..\MyLibrary.dll
    <ItemGroup> <Reference Include="MyLibrary"> <HintPath>..\MyLibrary.dll</HintPath> <Private>False</Private> </Reference> <!-- The rest of the code --> </ItemGroup>
  6. Save the
    CSPROJ
    file.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.