Skip to content

thangchung/spiderlightning-dotnet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NET on SpiderLightning

This is an example of how .NET can be integrated as a guest for SpiderLightning. It uses the wasi-experimental workload which is first available in .NET 8 Preview 4.

A Dockerfile has been provided to enable using these examples in a container.

Prerequisites

  • .NET 8 Preview 4 or later
  • Install the wasi-experimental workload
    • Run dotnet workload install wasi-experimental
  • WASI SDK
    • Download from wasi-sdk releases page. If you're using Windows, you need the one with mingw in its name.
    • Create an environment variable called WASI_SDK_PATH giving the path where you extracted the WASI SDK download, i.e., the directory containing bin/lib/share.
  • Slight
    • Download from SpiderLightning Releases
    • Once extracted, add the directory containing slight (or slight.exe on Windows) to your PATH.

How to build

  • git clone https://github.com/SteveSandersonMS/spiderlightning-dotnet.git
  • cd spiderlightning-dotnet
  • dotnet build (or open Spiderlightning.sln in Visual Studio)

Samples

There are two samples. You can run them from Visual Studio via Ctrl+F5, or from the command line:

  • ConsoleApp - demonstrates KeyValue API
    • cd sample/ConsoleApp
    • dotnet run
  • WebServer - demonstrates HTTP Server
    • cd sample/WebServer
    • dotnet run

Note that dotnet run is configured to run the project using slight, so you need that to be on your PATH. Alternatively, you can build and run manually:

  • dotnet build
  • slight -c slightfile.toml run bin\Debug\net8.0\wasi-wasm\AppBundle\ProjectName.wasm -l (where ProjectName is ConsoleApp or WebServer).

Publishing

When you're inside one of the sample directories, you can run dotnet publish. This will generate a .wasm file inside bin\Release\net8.0\wasi-wasm\AppBundle. You should be able to transfer that onto another machine/server and run it with slight.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 84.5%
  • C# 14.1%
  • Other 1.4%