Skip to content

964808: Remove net6 and net7 reference #6272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: hotfix/hotfix-v30.1.37
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions blazor/common/adding-script-references.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ N> The javascript interop files needs to be added to support the features that c

You can refer the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor scripts through the CDN resources.

* For **Blazor Web App**, reference scripts in `~/Components/App.razor` file.
* For **Blazor WASM App**, reference scripts in `~/wwwroot/index.html` file.
* For **Blazor Server App**, reference scripts in `~/Pages/_Layout.cshtml` file for `.NET 6` project and in `~/Pages/_Host.cshtml` file for `.NET 7` project.
* For **.NET 8 and .NET 9** Blazor Web Apps using any render mode (Server, WebAssembly, or Auto), reference scripts in `~/Components/App.razor` file.
* For **Blazor WASM Standalone App**, reference scripts in `~/wwwroot/index.html` file.

Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor components are available in CDN for each version. Make sure that the version in the URLs matches the version of the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Package you are using .

Expand Down Expand Up @@ -448,7 +447,7 @@ The following table lists components and its script reference.

## Custom Resource Generator

The Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor provides an option to generate a component's interop scripts using the [Custom Resource Generator](https://blazor.syncfusion.com/crg/) (CRG) tool for the Blazor components. Refer [here to generate the component-wise scripts externally using CRG](https://blazor.syncfusion.com/documentation/common/custom-resource-generator).
The Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor provides an option to generate a component's interop scripts using the [Custom Resource Generator](https://blazor.syncfusion.com/crg) (CRG) tool for the Blazor components. Refer [here to generate the component-wise scripts externally using CRG](https://blazor.syncfusion.com/documentation/common/custom-resource-generator).

## See also

Expand Down
32 changes: 3 additions & 29 deletions blazor/common/cdn-fallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This section provides information about how to refer fallback [scripts](https://

## Blazor Web App

For Blazor Web app, refer the script and style sheet fallback from [Static Web Assets](https://blazor.syncfusion.com/documentation/common/adding-script-references#static-web-assets) inside the Script tag like below.
For **.NET 8 and .NET 9** Blazor Web Apps using any render mode (Server, WebAssembly, or Auto), refer the script and style sheet fallback from [Static Web Assets](https://blazor.syncfusion.com/documentation/common/adding-script-references#static-web-assets) inside the Script tag like below.

### Script fallback

Expand Down Expand Up @@ -56,35 +56,9 @@ You can refer the theme stylesheet inside the `<head>` of **~/Components/App.raz
{% endhighlight %}
{% endtabs %}

## Blazor Server App
## Blazor WebAssembly Standalone App

CDN links can be down by connection issues or some other problems. This will cause the site looks broken. Follow the below steps to resolve these issues in the Blazor application.

If you are using CDN for style sheet references then you have to add style sheet fallback from [Static Web Assets](https://blazor.syncfusion.com/documentation/common/adding-script-references#static-web-assets) by using the [link tag helper](https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/link-tag-helper?view=aspnetcore-7.0). Syncfusion<sup style="font-size:70%">&reg;</sup> theme provides the `e-control` class. You can check the style from provided class by using link tag helper property.

* **~/Pages/_Host.cshtml** file for **.NET 7**.
* **~/Pages/_Layout.cshtml** for **.NET 6**.

{% tabs %}
{% highlight cshtml %}

<head>
...
<link rel="stylesheet" href="https://cdn.syncfusion.com/blazor/{{ site.blazorversion }}/styles/bootstrap5.css"
asp-fallback-href="_content/Syncfusion.Blazor.Themes/bootstrap5.css"
asp-fallback-test-class="e-control"
asp-fallback-test-property="font-size"
asp-fallback-test-value="12px" />
</head>

{% endhighlight %}
{% endtabs %}

N> Alternately, fallback links can be provided using [script fallback](#script-fallback) and [style sheet fallback](#style-sheet-fallback) in blazor server app.

## Blazor WebAssembly App

For Blazor WebAssembly app, refer the script and style sheet fallback from [Static Web Assets](https://blazor.syncfusion.com/documentation/common/adding-script-references#static-web-assets) inside the Script tag like below.
For Blazor WebAssembly Standalone app, refer the script and style sheet fallback from [Static Web Assets](https://blazor.syncfusion.com/documentation/common/adding-script-references#static-web-assets) inside the Script tag like below.

### Script fallback

Expand Down
8 changes: 3 additions & 5 deletions blazor/common/content-security-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ To use Syncfusion<sup style="font-size:70%">&reg;</sup> blazor components with s

These directives should be included in the `<head>` tag of the application's webpage, typically

* For **Blazor Web App**, inside the `<head>` of **~/Components/App.razor** file.
* For **Blazor Server application**, inside the `<head>` of
* **~/Pages/_Host.cshtml** file for .NET 7.
* **~/Pages/_Layout.cshtml** for .NET 6.
* For **Blazor WebAssembly App**, inside the `<head>` of **wwwroot/index.html** file.
* For **.NET 8 and .NET 9** Blazor Web Apps using any render mode (Server, WebAssembly, or Auto), inside the `<head>` of **~/Components/App.razor** file.

* For **Blazor WebAssembly Standalone App**, inside the `<head>` of **wwwroot/index.html** file.

{% tabs %}
{% highlight c# hl_lines="9 10" %}
Expand Down
13 changes: 5 additions & 8 deletions blazor/common/custom-resource-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ documentation: ug

# Custom Resource Generator

Syncfusion<sup style="font-size:70%">&reg;</sup> provides an option to generate a component's interop script and styles using the [Custom Resource Generator](https://blazor.syncfusion.com/crg/) (CRG) web tool for Blazor components from v19.2.0.44. This tool empowers users by generating precise interop scripts and styles specifically for their components. By leveraging the CRG, you can optimize loading times and enhance responsiveness compared to loading overall script and style resources.
Syncfusion<sup style="font-size:70%">&reg;</sup> provides an option to generate a component's interop script and styles using the [Custom Resource Generator](https://blazor.syncfusion.com/crg) (CRG) web tool for Blazor components from v19.2.0.44. This tool empowers users by generating precise interop scripts and styles specifically for their components. By leveraging the CRG, you can optimize loading times and enhance responsiveness compared to loading overall script and style resources.

![Custom resource generator preview for Blazor](images/custom-resource-generator-preview.png)

Expand All @@ -19,9 +19,9 @@ Search and select the required Syncfusion<sup style="font-size:70%">&reg;</sup>

Refer to the following steps to search and select the components in CRG:

1. Open [Syncfusion<sup style="font-size:70%">&reg;</sup> Custom Resource Generator](https://blazor.syncfusion.com/crg/) (CRG) application.
1. Open [Syncfusion<sup style="font-size:70%">&reg;</sup> Custom Resource Generator](https://blazor.syncfusion.com/crg) (CRG) application.
2. Type the required component name in the search bar, and then select the checkbox. The dependency of the selected component is resolved in the application itself, so you do not need to choose each dependent component manually.
![Search and select Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor UI components](images/search-non-injectable.png)
![Search and select Syncfusion Blazor UI components](images/search-non-injectable.png)
3. Select the required built-in themes from the **Select Themes** option. This provides an option to select more than one theme.
![Select the built-in themes in Blazor](images/select-inbuilt-themes.png)

Expand All @@ -47,11 +47,8 @@ N> When you download the resources of Material and Tailwind themes, either separ

1. Copy and paste the downloaded custom resources in the Blazor application `~/wwwroot` folder.
2. Now, manually add the custom interop script and styles in the Blazor App.
* For **Blazor Web App**, reference custom interop script in `~/Components/App.razor` file.
* For **Blazor WASM App**, reference custom interop script in `~/wwwroot/index.html` file.
* For **Blazor Server App**, reference custom interop script in
* `~/Pages/_Layout.cshtml` file for `.NET 6` project
* `~/Pages/_Host.cshtml` file for `.NET 7` project.
* For **.NET 8 and .NET 9** Blazor Web Apps using any render mode (Server, WebAssembly, or Auto), reference custom interop script in `~/Components/App.razor` file.
* For **Blazor WASM Standalone App**, reference custom interop script in `~/wwwroot/index.html` file.

```html
<head>
Expand Down
7 changes: 2 additions & 5 deletions blazor/common/data-binding/sql-server-data-binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The following software are needed:

* Microsoft.EntityFrameworkCore.SqlServer
* Visual Studio 2022
* .NET 6.0 or later.
* .NET 8.0 or later.

## Create the database

Expand Down Expand Up @@ -413,12 +413,9 @@ Themes provide life to components. Syncfusion<sup style="font-size:70%">&reg;</s

In this demo application, the latest theme will be used.

* For **Blazor Web App**, refer stylesheet inside the `<head>` of **~/Components/App.razor** file for .NET 8 and .NET 9.
* For **.NET 8 and .NET 9** Blazor Web Apps using any render mode (Server, WebAssembly, or Auto), refer stylesheet inside the `<head>` of **~/Components/App.razor** .

* For **Blazor WebAssembly application**, refer stylesheet inside the `<head>` element of **wwwroot/index.html** file.
* For **Blazor Server application**, refer stylesheet inside the `<head>` element of
* **~/Pages/_Host.cshtml** file for .NET 7.
* **~/Pages/_Layout.cshtml** file for .NET 6.

{% highlight cshtml %}

Expand Down
115 changes: 10 additions & 105 deletions blazor/common/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ In Blazor Web App and Blazor WASM app, you can set culture statically in Blazor'

The app's culture can be set in JavaScript by setting `applicationCulture` in Blazor's start option by following the steps below,

* For `Blazor Web App`, prevent Blazor autostart by adding `autostart="false"` attribute to the Blazor `<script>` tag in the **~/Components/App.razor** file.
* For **.NET 8 and .NET 9** Blazor Web Apps using any render mode (Server, WebAssembly, or Auto), prevent Blazor autostart by adding `autostart="false"` attribute to the Blazor `<script>` tag in the **~/Components/App.razor** file.

* For `Blazor WebAssembly App` , prevent Blazor autostart by adding `autostart="false"` attribute to Blazor's `<script>` tag in the **wwwroot/index.html** file.
* For `Blazor WebAssembly Standalone App` , prevent Blazor autostart by adding `autostart="false"` attribute to Blazor's `<script>` tag in the **wwwroot/index.html** file.

{% tabs %}

Expand All @@ -119,7 +119,7 @@ The app's culture can be set in JavaScript by setting `applicationCulture` in Bl

{% endhighlight %}

{% highlight cshtml tabtitle="Blazor WASM App" %}
{% highlight cshtml tabtitle="Blazor WASM Standalone App" %}

<body>
...
Expand Down Expand Up @@ -150,7 +150,7 @@ The app's culture can be set in JavaScript by setting `applicationCulture` in Bl
</body>

{% endhighlight %}
{% highlight cshtml tabtitle="Blazor WASM App" hl_lines="4 5 6 7 8" %}
{% highlight cshtml tabtitle="Blazor WASM Standalone App" hl_lines="4 5 6 7 8" %}

<body>
...
Expand Down Expand Up @@ -184,22 +184,6 @@ CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("de-DE");

{% endtabs %}

### Blazor Server App

* For **.NET 6 & .NET 7** app, specify the static culture in **~/Program.cs** file.

{% tabs %}

{% highlight c# tabtitle=".NET 6 & .NET 7 (~/Program.cs)" hl_lines="3" %}

...
var app = builder.Build();
app.UseRequestLocalization("de-DE");
...

{% endhighlight %}

{% endtabs %}

### MAUI Blazor App

Expand All @@ -224,9 +208,9 @@ CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("de-DE");

The culture can be set dynamically based on user's preference. The following example demonstrates how to use a localization cookie to store user's localization preference.

### Blazor Web App and Blazor WASM App
### Blazor Web App and Blazor Standalone WASM App

For `Blazor Web App and Blazor WASM App`, set the `BlazorWebAssemblyLoadAllGlobalizationData` property to true in the project file:
For `Blazor Web App and Blazor WASM Standalone App`, set the `BlazorWebAssemblyLoadAllGlobalizationData` property to true in the project file:

{% tabs %}

Expand All @@ -240,9 +224,9 @@ For `Blazor Web App and Blazor WASM App`, set the `BlazorWebAssemblyLoadAllGloba

{% endtabs %}

* For Blazor Web App, add JS function in `~/Components/App.razor` file (after Blazor's `<script>` tag and before the closing `</body>`), to get and set the user's selected culture in the browser local storage.
* For **.NET 8 and .NET 9** Blazor Web Apps using any render mode (Server, WebAssembly, or Auto), add JS function in `~/Components/App.razor` file (after Blazor's `<script>` tag and before the closing `</body>`), to get and set the user's selected culture in the browser local storage.

* For Blazor WASM App, add JS function in `wwwroot/index.html` file (after Blazor's `<script>` tag and before the closing `</body>`), to get and set the user's selected culture in the browser local storage.
* For Blazor WASM Standalone App, add JS function in `wwwroot/index.html` file (after Blazor's `<script>` tag and before the closing `</body>`), to get and set the user's selected culture in the browser local storage.

{% tabs %}
{% highlight cshtml tabtitle="Blazor Web App" hl_lines="2 3 4 5 6 7" %}
Expand Down Expand Up @@ -374,7 +358,7 @@ Add the `CultureSwitcher` component to `~/MainLayout.razor` to enable the cultur
</div>

{% endhighlight %}
{% highlight razor tabtitle="Blazor WASM App" %}
{% highlight razor tabtitle="Blazor WASM Standalone App" %}

<div class="page">
....
Expand All @@ -398,46 +382,6 @@ If you create a Blazor Web App with an **Interactive render mode** as `Server` m

{% tabs %}

{% highlight c# tabtitle=".NET 6 & .NET 7 (~/Program.cs)" hl_lines="7 11 13 14 15 16 17 20 31" %}

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddControllers();

builder.Services.AddSyncfusionBlazor();
//Register the Syncfusion locale service to localize Syncfusion Blazor components.
builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer));

var supportedCultures = new[] { "en-US", "de-DE", "fr-FR", "ar-AE", "zh-HK" };
var localizationOptions = new RequestLocalizationOptions()
.SetDefaultCulture(supportedCultures[0])
.AddSupportedCultures(supportedCultures)
.AddSupportedUICultures(supportedCultures);

var app = builder.Build();
app.UseRequestLocalization(localizationOptions);
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.MapControllers();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();

{% endhighlight %}

{% highlight c# tabtitle=".NET 9 & .NET 8 (~/Program.cs)" hl_lines="4 6 7 8 9 10 13 24" %}

builder.Services.AddControllers();
Expand Down Expand Up @@ -472,27 +416,9 @@ app.Run();
{% endhighlight %}
{% endtabs %}

For .NET 6 and 7 set the current culture in a cookie immediately after opening <body> tag of `Pages/_Host.cshtml`.

For .NET 9 and .NET 8 set the current culture in a cookie in App component file

{% tabs %}
{% highlight c# tabtitle=".NET 6 & .NET 7 (_Host.cshtml)" hl_lines="6 7 8 9 10 11" %}

@using Microsoft.AspNetCore.Http
@using Microsoft.AspNetCore.Localization
@using System.Globalization
@{

HttpContext.Response.Cookies.Append(
CookieRequestCultureProvider.DefaultCookieName,
CookieRequestCultureProvider.MakeCookieValue(
new RequestCulture(
CultureInfo.CurrentCulture,
CultureInfo.CurrentUICulture)));
}

{% endhighlight %}

{% highlight C# tabtitle=".NET 9 & .NET 8 (App.razor)" %}

Expand Down Expand Up @@ -550,7 +476,7 @@ Create `CultureSwitcher` component and place it inside shared folder to perform

{% tabs %}

{% highlight razor tabtitle=".NET 6 & .NET 7 (Shared/CultureSwitcher.razor) .NET 9 & .NET 8 (Components/Pages/CultureSwitcher.razor)" %}
{% highlight razor tabtitle=".NET 9 & .NET 8 (Components/Pages/CultureSwitcher.razor)" %}

@using System.Globalization
@inject NavigationManager NavigationManager
Expand Down Expand Up @@ -612,27 +538,6 @@ Add the `CultureSwitcher` component to `Shared/MainLayout.razor` to enable the c

{% tabs %}

{% highlight razor tabtitle=".NET 6 & .NET 7 (Shared/MainLayout.razor)" %}

<div class="page">
<div class="sidebar">
<NavMenu />
</div>

<main>
<div class="top-row px-4">
<CultureSwitcher />
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
</div>

<article class="content px-4">
@Body
</article>
</main>
</div>

{% endhighlight %}

{% highlight razor tabtitle=".NET 9 & .NET 8 (Components/Layout/MainLayout.razor)" %}

<div class="page">
Expand Down
Loading