Skip to content

This repository contains the source of both OpenSilver and CSHTML5. More information is available at: www.opensilver.net and www.cshtml5.com - Read README.md for the instructions on how to build the source code and how to test it.

License

Notifications You must be signed in to change notification settings

jacob-l/OpenSilver

 
 

Repository files navigation

OpenSilver Logo

OpenSilver

Build Cross-Platform Apps with C#, VB.NET, or F# and XAML
One codebase. Six platforms. Powered by WebAssembly and .NET.

NuGet MIT License Website

Website · Documentation · Try Online · 200+ Live Samples · Gallery · What's New · Contact


Table of Contents


What is OpenSilver?

OpenSilver is a modern, open-source framework for building cross-platform applications using C#, VB.NET, or F# combined with XAML. Write your code once and deploy to:

  • Web (via WebAssembly)
  • Android, iOS, Windows, macOS (via .NET MAUI-OpenSilver Hybrid)
  • Linux (via Photino)

OpenSilver is like WPF, but cross-platform and evolved. It brings the productivity of XAML and the power of .NET to every major platform.

OpenSilver is like WPF but cross-platform and evolved


Features

  • WPF API Compatibility (Subset): OpenSilver implements a large and growing subset of the WPF API. Same namespaces, same XAML, same patterns (MVVM, data binding, commands, styles, templates). If you know WPF, you already know OpenSilver.
  • True Cross-Platform: Single codebase compiles to Web, Android, iOS, Windows, macOS, and Linux.
  • DOM-Based Rendering: XAML renders to real HTML elements, unlocking native browser behaviors: accessibility, SEO, Ctrl+F, text selection, screen readers, browser translation, and more.
  • Multi-Language Support: Write in C#, VB.NET, or F#. OpenSilver is one of the very few solutions that lets you build web apps with VB.NET + XAML or F# + XAML.
  • Full .NET Ecosystem: Reference any .NET NuGet package. OpenSilver and Blazor WASM share the same .NET for WebAssembly stack, so any non-UI package that works in Blazor will work in OpenSilver too.
  • Blazor Integration: Mix XAML and Razor files in the same project. Embed Blazor components (DevExpress, Syncfusion, Radzen, Blazorise, MudBlazor, etc.) directly inside XAML. Learn more
  • JavaScript Interop: Call any JavaScript library from C#. Full access to the JS ecosystem from all target platforms. Learn more · Interop Samples · JS Libraries Samples
  • Visual XAML Designer: Drag-and-drop UI designer in Visual Studio, VS Code (Windows, macOS, Linux), and online at XAML.io. The first XAML designer for VS Code!

Drag-and-drop XAML designer in VS Code on macOS


How It Works

OpenSilver is not an emulator, a wrapper, or an Electron-style bundled browser. It is a complete reimplementation of the WPF/Silverlight API from scratch, using modern .NET, WebAssembly, and the browser's DOM.

On the Web, your C# code compiles to WebAssembly. Unlike canvas-based rendering approaches, XAML is rendered at runtime using real HTML elements: TextBox becomes <textarea>, MediaElement becomes <video>, PasswordBox becomes <input type="password">, Image becomes <img>, and so on. This unlocks native browser behaviors like Ctrl+F search, text selection (to copy text), screen readers, SEO indexing, browser translation, mobile long-press, UI automated testing, and accessibility compliance. The compiled app is a set of static files (WebAssembly, JS, index.html...) that can be hosted anywhere: Azure, AWS, GitHub Pages, or any basic web server. No special server technology is required.

On desktop and mobile (via MAUI-OpenSilver Hybrid or Photino), the UI is still rendered as HTML/CSS, but C# runs as native .NET instead of WebAssembly. This preserves full compatibility with JS libraries and Blazor components (because the UI is still HTML/CSS), while adding native performance and direct access to platform APIs (because the runtime is native .NET).

OpenSilver compilation targets


Try OpenSilver Without Installing Anything

XAML.io: Write and run C#/XAML code directly in your browser. No installation required. Perfect for quick experiments, learning, and sharing code snippets.

XAML.io Screenshot

OpenSilverShowcase.com: Over 200 interactive C#/XAML samples running live. View source code for each sample with a toggle to switch between C#, VB.NET, and F#. Includes examples of Blazor component integration. Also available on Android and iOS. Source code.

OpenSilverShowcase.com Screenshot    OpenSilver Showcase on mobile

Visit the Gallery to see real-world applications built with OpenSilver.


Migrating from WPF, Silverlight, or LightSwitch?

Because OpenSilver implements a subset of the WPF API, it provides a realistic path to bring existing applications to the web and mobile without a full rewrite:

  • Silverlight apps: 99% API compatibility, minimal code changes needed
  • WPF apps: 70%+ API compatibility and growing with every release
  • LightSwitch apps: supported via a dedicated Compatibility Pack (Learn more · Request Compatibility Pack)
  • WinForms apps: possible, though more refactoring is required

The team that built OpenSilver has been migrating enterprise applications since 2014. Whether you need a full end-to-end migration, help porting a specific module, or want to accelerate the implementation of a WPF feature your app depends on, we work with teams of all sizes.

We offer free migration assessments. Let's talk about your project


Create Your First OpenSilver App

Visual Studio (Windows)

  1. Install Visual Studio 2022 or newer (VS 2026 is supported) with the ASP.NET and web development and .NET desktop development workloads, plus .NET 8.0 SDK or later
  2. Download the OpenSilver extension (VSIX) from opensilver.net/download
  3. Click "Create a new project", search for "OpenSilver", and choose your target platforms

OpenSilver Project Wizard

4. Press `F5` to build and run!

--

Preview packages: If you want the very latest iteration of OpenSilver, check "Include prerelease" in the NuGet Package Manager. Preview packages are built for each commit on the develop branch and published to a MyGet feed (already configured in your nuget.config). Learn more

Visual Studio Code (Windows, macOS, Linux)

Install the OpenSilver extension for VS Code (includes project templates and the visual XAML designer), then use the Command Palette (Ctrl+Shift+P) and run OpenSilver: Create New Project. Learn more

Command Line (CLI)

dotnet new install OpenSilver.Templates
dotnet new opensilverapp -n MyApp
cd MyApp && dotnet run --project MyApp.Browser

XAML.io (No Installation)

Visit XAML.io, create your project in the browser, then click File > Download Visual Studio Solution to continue working locally in Visual Studio or VS Code.

Solution Structure

OpenSilver Solution Structure

Project Description
MyApp Main project containing all your C#/XAML files. Cannot be run directly.
MyApp.Browser Entry point for Web deployment (WebAssembly)
MyApp.MauiHybrid Entry point for Android, iOS, Windows, macOS (via .NET MAUI)
MyApp.Photino Entry point for Linux desktop (via Photino)
MyApp.Simulator Entry point for the Simulator, which provides the best debugging experience (faster startup, better exception reporting, full .NET debugging features such as move execution point, etc.)

Code Sample

<!-- MainPage.xaml -->
<Page x:Class="MyApp.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
        <TextBlock Text="Hello, OpenSilver!" FontSize="32" Margin="0,0,0,20"/>
        <Button Content="Click Me!" Click="Button_Click"/>
        <TextBlock x:Name="ResultText" FontSize="18" Margin="0,20,0,0"/>
    </StackPanel>
</Page>
// MainPage.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;

namespace MyApp;

public partial class MainPage : Page
{
    private int clickCount = 0;

    public MainPage()
    {
        InitializeComponent();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        clickCount++;
        ResultText.Text = $"Button clicked {clickCount} time(s)!";
    }
}

This example uses C#, but VB.NET and F# work equally well with XAML. See all three languages side by side on OpenSilverShowcase.com.


Performance Tips

Debug mode is not representative of production performance. Here is a benchmark rendering 30,000 XAML UI elements (OpenSilver 3.2):

Mode Time vs. Debug
Debug (from VS) 2,150 ms baseline
Release (from VS) 1,630 ms 1.3x faster
Published 760 ms 2.8x faster
Published + AOT 360 ms 6x faster

For best results in production, publish with AOT enabled. Other common optimizations include enabling virtualization for large lists/comboboxes/treeviews, using IIS compression, lazy-loading large assemblies, and trimming to reduce the app size. Learn more


Documentation and Resources

Resource Description
Official Documentation Comprehensive guides, tutorials, and API reference
Getting Started Tutorial Step-by-step walkthrough for beginners
Common Issues and Solutions Troubleshooting tips
OpenSilverShowcase.com 200+ live samples with source code

Building from Source

Want to contribute or customize OpenSilver? See BUILDING.md for full instructions on cloning, building, and using custom NuGet packages.

The extensions for VS and VS Code can also built from source: github.com/OpenSilver/OpenSilver.VSIX


Contributing

We welcome contributions from the community! Whether it's fixing bugs, improving documentation, or adding new features, every contribution helps make OpenSilver better.

Missing a WPF feature? Request it on GitHub or sponsor its development to accelerate its implementation.


Related Repositories

Repository Description
OpenSilver.VSIX Source code for Visual Studio, VS Code, and CLI extensions
OpenSilver.Documentation Documentation source
OpenSilver.Samples.Showcase Source code for the Showcase app (200+ samples)

License

OpenSilver is free and open source, released under the MIT License.

You can use OpenSilver in commercial projects without any licensing fees. While not required, attribution and links to opensilver.net are greatly appreciated!


Get in Touch

Website opensilver.net
Documentation doc.opensilver.net
Contact opensilver.net/contact
Email contact@opensilver.net

Work with the Core Team

OpenSilver is built and maintained by Userware. It is free and MIT licensed. Working with Userware directly funds the roadmap toward full WPF API coverage and helps make OpenSilver better for everyone.

How we can help:

  • Migrate your WPF, Silverlight, LightSwitch, or WinForms application
  • Accelerate the implementation of a specific feature your project needs
  • Support your team with priority assistance, training, or consulting

Get in touch


⭐ Star this repository if you find OpenSilver useful!
Your support helps us grow the community and improve the framework.

About

This repository contains the source of both OpenSilver and CSHTML5. More information is available at: www.opensilver.net and www.cshtml5.com - Read README.md for the instructions on how to build the source code and how to test it.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • C# 99.1%
  • JavaScript 0.6%
  • Batchfile 0.1%
  • HTML 0.1%
  • PowerShell 0.1%
  • CSS 0.0%