SteveSandersonMS / dotnet-wasi-sdk

Packages for building .NET projects as standalone WASI-compliant modules
518 stars 36 forks source link

Detecting if running under WASI #56

Closed andrewmd5 closed 1 year ago

andrewmd5 commented 1 year ago

Is there a way to detect if the current platform is WASI? I could pass some sort of environment variable, but it would be nice to have a means built-in.

andrewmd5 commented 1 year ago

The answer is var isWasm = RuntimeInformation.OSArchitecture is Architecture.Wasm;