Installation
SolarSharp is distributed as a NuGet package and can be easily added to any .NET project. This guide covers installation for various project types and package managers.NuGet Package
The main SolarSharp package is:SolarSharp.Interpreter
The core SolarSharp interpreter library
Installation Methods
Choose your preferred package manager:- .NET CLI
- Package Manager Console
- PackageReference
- Visual Studio
The .NET CLI is the recommended way to add packages in modern .NET projects:To install a specific version:
Platform Requirements
SolarSharp supports multiple .NET target frameworks:.NET Standard 2.0
Compatible with .NET Framework 4.6.1+
.NET Standard 2.1
Optimized for modern .NET features
.NET 9.0+
Latest .NET runtime support
Compatible Platforms
SolarSharp works on a wide range of platforms:- .NET Core 2.0+ and .NET 5.0+
- .NET Framework 4.6.1+
- Unity3D (including IL2CPP)
- Xamarin.iOS and Xamarin.Android
- Mono
- UWP (Universal Windows Platform)
- Ahead-of-time (AOT) compilation platforms like iOS
No external dependencies are required. SolarSharp is self-contained and includes everything needed to run Lua scripts.
Dependencies
SolarSharp has minimal dependencies that are automatically installed:Core Dependencies
Core Dependencies
Microsoft.CodeAnalysis.CSharp(4.14.0) - For dynamic code generationSystem.Runtime.CompilerServices.Unsafe(6.0.0) - For performance optimizationsMicrosoft.Bcl.HashCode(6.0.0) - For consistent hashing across platformsMicrosoft.Bcl.Memory(9.0.7) - For memory management utilities
Framework-Specific Dependencies
Framework-Specific Dependencies
For .NET Standard 2.0 and 2.1 targets:
Microsoft.CSharp(4.7.0) - For dynamic language runtime support
Unity3D Installation
For Unity projects, you have several options:Option 1: Unity Package Manager (Recommended)
Add the following to your
manifest.json in the Packages folder:Option 2: Download DLL
- Download the latest release from NuGet
- Extract the
.nupkgfile (rename to.zipif needed) - Copy the DLL from
lib/netstandard2.0/to your UnityAssets/Pluginsfolder
Verify Installation
After installation, verify that SolarSharp is working correctly:Troubleshooting
Package restore fails
Package restore fails
Ensure you have an internet connection and that your NuGet sources are configured correctly:The nuget.org source should be present. If not, add it:
Type or namespace not found
Type or namespace not found
Make sure you have the correct using directive:And verify the package is properly restored:
Unity compilation errors
Unity compilation errors
If you encounter errors in Unity:
- Ensure you’re using a compatible Unity version (.NET Standard 2.0+)
- Check that the DLL is placed in the correct folder (Assets/Plugins)
- Verify the DLL’s import settings in the Unity Inspector
- For IL2CPP, ensure you have a proper link.xml configuration
Version conflicts
Version conflicts
If you have version conflicts with dependencies, you can force a specific version in your
.csproj:Upgrading from MoonSharp
If you’re migrating from MoonSharp to SolarSharp:Next Steps
Now that you have SolarSharp installed:Quickstart Guide
Run your first Lua script in under 5 minutes
Core Concepts
Learn the fundamentals of SolarSharp
API Reference
Explore the complete API documentation
Examples
Browse practical code examples
Getting Help
If you encounter any issues during installation:- Check the GitHub Issues for known problems
- Review the Contributing Guide
- Ask questions in the community forums
SolarSharp version 2.0.0.0 supports Lua 5.2. Check the version constant in the Script class for the exact versions.