Skip to content

tags: - installation - setup - nuget - getting-started


Installation

This guide covers the prerequisites and setup required to use EverSharp in your .NET projects.


Prerequisites

Required

  • Visual Studio 2022 (17.8 or later) or Visual Studio Code
  • C# development experience for integration scenarios

Installation Methods

Method 1: NuGet Package

The EverSharp library is available as a NuGet package (package details to be added).

Using .NET CLI:

dotnet add package Elements.Libs.EverSharp

Using Package Manager Console (Visual Studio):

Install-Package Elements.Libs.EverSharp

Using Visual Studio UI:

  1. Right-click on your project in Solution Explorer
  2. Select Manage NuGet Packages
  3. Search for "Elements.Libs.EverSharp"
  4. Click Install

Method 2: Project Reference

If you have access to the source code, you can reference the project directly:

<ItemGroup>
  <ProjectReference Include="..\Elements.Libs.EverSharp\Elements.Libs.EverSharp.csproj" />
</ItemGroup>

Verify Installation

Create a simple C# file to verify the installation:

using Elements.Libs.EverSharp;

var runner = new EverSharpRunner();
runner.Run("result = 10 + 20;");

if (!runner.HasErrors)
{
    var result = runner.GlobalVariables["result"];
    Console.WriteLine($"Result: {result}"); // Output: Result: 30
}
else
{
    Console.WriteLine("Errors occurred:");
    foreach (var error in runner.Errors)
    {
        Console.WriteLine(error);
    }
}

Run the code:

dotnet run

Expected output:

Result: 30

If you see this output, EverSharp is correctly installed and working!


Project Setup

Create New Console Application

# Create new console app
dotnet new console -n MyEverSharpApp
cd MyEverSharpApp

# Add EverSharp package
dotnet add package Elements.Libs.EverSharp

# Run
dotnet run

Minimum Project File

Your .csproj file should target .NET 9.0:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Elements.Libs.EverSharp" Version="*" />
  </ItemGroup>
</Project>

Dependencies

EverSharp has minimal dependencies. The core library requires:

  • Newtonsoft.Json - For JSON serialization
  • Elements.Libs.Extensions - Internal extensions library

These dependencies are automatically resolved when you install the NuGet package.


Namespace Imports

In your C# files, import the required namespace:

using Elements.Libs.EverSharp;

For working with dictionaries and type conversions:

using Elements.Libs.Extensions.EverDictionaries;

Common Issues

Issue: Package Not Found

Problem: NuGet package cannot be found

Solution: Ensure you have access to the package feed. You may need to configure authentication for private feeds.

Issue: Target Framework Mismatch

Problem: "The current .NET SDK does not support targeting .NET 9.0"

Solution:

  1. Install .NET 9.0 SDK
  2. Verify with dotnet --version
  3. Update your project's TargetFramework to net9.0

Issue: Namespace Not Found

Problem: "The type or namespace name 'EverSharpRunner' could not be found"

Solution:

  1. Ensure package is installed: dotnet restore
  2. Add using directive: using Elements.Libs.EverSharp;
  3. Rebuild project: dotnet build

IDE Setup

Visual Studio 2022

  1. Open or create a C# project
  2. Right-click project → Manage NuGet Packages
  3. Install Elements.Libs.EverSharp
  4. Add using Elements.Libs.EverSharp; to your code

Visual Studio Code

  1. Install C# Dev Kit extension
  2. Open project folder
  3. Open integrated terminal
  4. Run: dotnet add package Elements.Libs.EverSharp
  5. Add using Elements.Libs.EverSharp; to your code

JetBrains Rider

  1. Open or create a C# project
  2. Right-click project → Manage NuGet Packages
  3. Search and install Elements.Libs.EverSharp
  4. Add using Elements.Libs.EverSharp; to your code

Next Steps

Now that you have EverSharp installed:

  1. Try the basics: Hello World
  2. Learn the API: Using EverSharpRunner
  3. Explore the language: Data Types

Additional Resources