Build modern, interactive web-based UIs with C# and Razor.
Features of the components programming model include:
- A powerful model for building composable UI
- Forms and validation
- Dependency injection
- Live reloading in the browser during development
- Server-side rendering
- Full .NET debugging
- Rich IntelliSense and tooling
Razor Components is a built-in feature of ASP.NET Core 3.0. It provides a convenient and powerful way to create sophisticated UIs that update in real-time, while keeping all your code in .NET running on the server.
Note: client-side Blazor is an experimental project. It's not yet a committed product . This is to allow time to fully investigate the technical issues associated with running .NET in the browser and to ensure we can build something that developers love and can be productive with. During this experimental phase, we expect to engage deeply with early Blazor adopters like you to hear your feedback and suggestions.
To get started and build your first web app check out our getting started guide.
Building from source
You only need to do this if you want to contribute to this repo. You do not need to build from source if you just want to build your own application.
For general guidance on building ASP.NET Core sources, see the developer documentation. Please read this document and check your PATH setup if you have trouble building or using Visual Studio.
Ensure you have the following:
- Node.js (>10.0)
Clone this repo, and switch to its directory:
git clone https://github.com/aspnet/AspNetCore.git cd AspNetCore
cd src\Components build.cmd
cd src/Components ./build.sh
Run unit tests
build.cmd /t:Test or
Run end-to-end tests
- Install selenium-standalone (requires Java 8 or 9)
- Open JDK9
npm install -g selenium-standalone
In a separate command prompt, run
build.cmd /t:Test /p:BlazorAllTests=true or
build.sh /t:Test /p:BlazorAllTests=true
Opening in Visual Studio
- Visual Studio 2017 15.9 - download
When installing Visual Studio choose the following workloads:
- ASP.NET and Web Development
- Visual Studio extension development features
src/Components/Component.sln in Visual Studio.
If you have problems using Visual Studio with
Components.sln please refer to the developer documentation.
Developing the Blazor VS Tooling
To do local development of the Blazor tooling experience in VS, select the
project and launch the debugger.
The Blazor Visual Studio tooling will build as part of the command line build when on Windows.
Using CI Builds of Blazor
To use a nightly or developer CI build of the Blazor package, ensure that you have the Blazor package feed configured, and update your package version numbers. You should use developer builds only with the expectation that things will break and change without any sort of announcement.
Update your projects to include the Blazor development feed (
https://dotnet.myget.org/f/blazor-dev/api/v3/index.json). You can do this in a project file with MSBuild:
<RestoreAdditionalProjectSources> https://dotnet.myget.org/f/blazor-dev/api/v3/index.json; </RestoreAdditionalProjectSources>
Or in a NuGet.config in the same directory as the solution file:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <clear /> <add key="blazor" value="https://dotnet.myget.org/f/blazor-dev/api/v3/index.json" /> <add key="nuget" value="https://api.nuget.org/v3/index.json" /> </packageSources> </configuration>
You can browse https://dotnet.myget.org/gallery/blazor-dev to find the current versions of packages. We recommend picking a specific version of the packages and using it across your projects.
<ItemGroup> <PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="0.3.0-preview1-10220" /> <PackageReference Include="Microsoft.AspNetCore.Components.Build" Version="0.3.0-preview1-10220" PrivateAssets="all" /> <DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.3.0-preview1-10220" /> </ItemGroup>
To install a developer CI build of the Blazor Language Service extension for Visual Studio, add https://dotnet.myget.org/F/blazor-dev/vsix/ as an additional extension gallery by going to Tools -> Options -> Environment -> Extensions and Updates:
You should then be able to install or update the Blazor Language Service extension from the developer CI feed using the Extensions and Updates dialog.
There are lots of ways that you can contribute to Blazor! Read our contributing guide to learn about our development process and how to propose bug fixes and improvements.