原文:
https://docs.devexpress.com/Blazor/401986/getting-started/install-components-and-create-an-application/without-devexpress-installer/microsoft-templates#2-obtain-your-devexpress-nuget-feed
This topic describes how to:
These instructions are also available in the following videos:
The steps below describe how to create a new Blazor project. If you want to add DevExpress Blazor components to an existing application, go to Step 2.
You need to obtain your personal NuGet feed URL to access the DevExpress.Blazor NuGet package from your project.
nuget.org
package source is also enabled.
DevExpress.Blazor
NuGet package.
Add the following line to the Pages/_Host.cshtml
file's HEAD section:
<head>
<!--...-->
<link href="_content/DevExpress.Blazor/dx-blazor.css" rel="stylesheet" />
</head>
Register the DevExpress.Blazor namespace in the _Imports.razor
file:
@using DevExpress.Blazor
Add the following line to the wwwroot/index.html
file's HEAD section:
<head>
<!--...-->
<link href="_content/DevExpress.Blazor/dx-blazor.css" rel="stylesheet" />
</head>
Call the AddDevExpressBlazor(IServiceCollection, Action<GlobalOptions>) method from your project's Program.Main()
method:
using Microsoft.Extensions.DependencyInjection;
public class Program {
public static async Task Main(string[] args) {
var builder = WebAssemblyHostBuilder.CreateDefault(args);
// ...
builder.Services.AddDevExpressBlazor();
await builder.Build().RunAsync();
}
}
Register the DevExpress.Blazor namespace in the _Imports.razor
file:
@using DevExpress.Blazor
Configure the linker as described in Configure the Linker for ASP.NET Core Blazor .
If you enabled the ASP.NET Core hosted option when you create the project, make sure that the server-side project is set as the solution's startup project.
For instructions on how to add an individual DevExpress Blazor component to your application, refer to the documents below: