Skip to content

Commit 77c0463

Browse files
authored
Merge pull request #17850 from dotnet/master
2 parents 6c8cff2 + 8a61d1d commit 77c0463

18 files changed

Lines changed: 65 additions & 166 deletions

File tree

aspnetcore/blazor/common/samples/3.x/BlazorWebAssemblySample/BlazorSample.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview3.20168.3" />
10-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview3.20168.3" PrivateAssets="all" />
11-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.0-preview3.20168.3" PrivateAssets="all" />
12-
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.2.0-preview3.20168.3" />
9+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview4.20210.8" />
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview4.20210.8" PrivateAssets="all" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.0-preview4.20210.8" PrivateAssets="all" />
12+
<PackageReference Include="System.Net.Http.Json" Version="3.2.0-preview5.20210.3" />
1313
</ItemGroup>
1414

1515
</Project>

aspnetcore/blazor/common/samples/3.x/BlazorWebAssemblySample/Pages/CallWebAPI.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ else
8787

8888
protected override async Task OnInitializedAsync() => await GetTodoItems();
8989

90-
private async Task GetTodoItems() => _todoItems = await Http.GetJsonAsync<TodoItem[]>(ServiceEndpoint);
90+
private async Task GetTodoItems() => _todoItems = await Http.GetFromJsonAsync<TodoItem[]>(ServiceEndpoint);
9191

9292
private void EditItem(long id)
9393
{
@@ -99,15 +99,15 @@ else
9999
private async Task AddItem()
100100
{
101101
var addItem = new TodoItem { Name = _newItemName, IsComplete = false };
102-
await Http.PostJsonAsync(ServiceEndpoint, addItem);
102+
await Http.PostAsJsonAsync(ServiceEndpoint, addItem);
103103
_newItemName = string.Empty;
104104
await GetTodoItems();
105105
_editRowStyle = "none";
106106
}
107107

108108
private async Task SaveItem()
109109
{
110-
await Http.PutJsonAsync($"{ServiceEndpoint}/{_editItem.Id}", _editItem);
110+
await Http.PutAsJsonAsync($"{ServiceEndpoint}/{_editItem.Id}", _editItem);
111111
await GetTodoItems();
112112
_editRowStyle = "none";
113113
}

aspnetcore/blazor/common/samples/3.x/BlazorWebAssemblySample/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Net.Http;
23
using System.Collections.Generic;
34
using System.Threading.Tasks;
45
using System.Text;
@@ -14,7 +15,7 @@ public static async Task Main(string[] args)
1415
var builder = WebAssemblyHostBuilder.CreateDefault(args);
1516
builder.RootComponents.Add<App>("app");
1617

17-
builder.Services.AddBaseAddressHttpClient();
18+
builder.Services.AddSingleton(new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
1819

1920
await builder.Build().RunAsync();
2021
}

aspnetcore/blazor/common/samples/3.x/BlazorWebAssemblySample/_Imports.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@using System.Net.Http
2+
@using System.Net.Http.Json
23
@using Microsoft.AspNetCore.Components.Forms
34
@using Microsoft.AspNetCore.Components.Routing
45
@using Microsoft.AspNetCore.Components.Web

aspnetcore/blazor/debug.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to debug Blazor apps.
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: riande
77
ms.custom: mvc
8-
ms.date: 03/26/2020
8+
ms.date: 04/16/2020
99
no-loc: [Blazor, SignalR]
1010
uid: blazor/debug
1111
---
@@ -47,7 +47,7 @@ Debugging requires either of the following browsers:
4747

4848
## Enable debugging for Visual Studio and Visual Studio Code
4949

50-
Debugging is enabled automatically for new projects that are created using the ASP.NET Core 3.2 Preview 3 or later Blazor WebAssembly project template.
50+
Debugging is enabled automatically for new projects that are created using the ASP.NET Core 3.2 Preview 3 or later Blazor WebAssembly project template ([current release is 3.2 Preview 4](xref:blazor/get-started)).
5151

5252
To enable debugging for an existing Blazor WebAssembly app, update the *launchSettings.json* file in the startup project to include the following `inspectUri` property in each launch profile:
5353

aspnetcore/blazor/get-started.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Get started with Blazor by building a Blazor app with the tooling o
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: riande
77
ms.custom: mvc
8-
ms.date: 04/09/2020
8+
ms.date: 04/16/2020
99
no-loc: [Blazor, SignalR]
1010
uid: blazor/get-started
1111
---
@@ -25,6 +25,12 @@ To get started with Blazor, follow the guidance for your choice of tooling:
2525

2626
For information on the two Blazor hosting models, *Blazor WebAssembly* and *Blazor Server*, see <xref:blazor/hosting-models>.
2727

28+
1. Install the [Blazor WebAssembly](xref:blazor/hosting-models#blazor-webassembly) preview template by running the following command:
29+
30+
```dotnetcli
31+
dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview4.20210.8
32+
```
33+
2834
1. Create a new project.
2935

3036
1. Select **Blazor App**. Select **Next**.
@@ -42,11 +48,11 @@ To get started with Blazor, follow the guidance for your choice of tooling:
4248
1. Optionally install the [Blazor WebAssembly](xref:blazor/hosting-models#blazor-webassembly) preview template by running the following command:
4349

4450
```dotnetcli
45-
dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3
51+
dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview4.20210.8
4652
```
4753

4854
> [!NOTE]
49-
> The [.NET Core SDK version 3.1.201 or later](https://dotnet.microsoft.com/download/dotnet-core/3.1) is **required** to use the 3.2 Preview 3 Blazor WebAssembly template. Confirm the installed .NET Core SDK version by running `dotnet --version` in a command shell.
55+
> The [.NET Core SDK version 3.1.201 or later](https://dotnet.microsoft.com/download/dotnet-core/3.1) is **required** to use the 3.2 Preview 4 Blazor WebAssembly template. Confirm the installed .NET Core SDK version by running `dotnet --version` in a command shell.
5056
5157
1. Install [Visual Studio Code](https://code.visualstudio.com/).
5258

@@ -105,11 +111,11 @@ If a prompt appears to trust the development certificate, trust the certificate
105111
1. Optionally install the [Blazor WebAssembly](xref:blazor/hosting-models#blazor-webassembly) preview template by running the following command:
106112

107113
```dotnetcli
108-
dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3
114+
dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview4.20210.8
109115
```
110116

111117
> [!NOTE]
112-
> The [.NET Core SDK version 3.1.201 or later](https://dotnet.microsoft.com/download/dotnet-core/3.1) is **required** to use the 3.2 Preview 3 Blazor WebAssembly template. Confirm the installed .NET Core SDK version by running `dotnet --version` in a command shell.
118+
> The [.NET Core SDK version 3.1.201 or later](https://dotnet.microsoft.com/download/dotnet-core/3.1) is **required** to use the 3.2 Preview 4 Blazor WebAssembly template. Confirm the installed .NET Core SDK version by running `dotnet --version` in a command shell.
113119
114120
1. For a Blazor Server experience, execute the following commands in a command shell:
115121

aspnetcore/blazor/hosting-model-configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn about Blazor hosting model configuration, including how to in
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: riande
77
ms.custom: mvc
8-
ms.date: 04/07/2020
8+
ms.date: 04/16/2020
99
no-loc: [Blazor, SignalR]
1010
uid: blazor/hosting-model-configuration
1111
---
@@ -62,7 +62,7 @@ Obtain the app's environment in a component by injecting `IWebAssemblyHostEnviro
6262

6363
### Configuration
6464

65-
As of the ASP.NET Core 3.2 Preview 3 release, Blazor WebAssembly supports configuration from:
65+
As of the ASP.NET Core 3.2 Preview 3 release ([current release is 3.2 Preview 4](xref:blazor/get-started)), Blazor WebAssembly supports configuration from:
6666

6767
* *wwwroot/appsettings.json*
6868
* *wwwroot/appsettings.{ENVIRONMENT}.json*

aspnetcore/client-side/bundling-and-minification.md

Lines changed: 3 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: scottaddie
44
description: Learn how to optimize static resources in an ASP.NET Core web application by applying bundling and minification techniques.
55
ms.author: scaddie
66
ms.custom: mvc
7-
ms.date: 06/17/2019
7+
ms.date: 04/15/2020
88
uid: client-side/bundling-and-minification
99
---
1010
# Bundle and minify static assets in ASP.NET Core
@@ -57,7 +57,7 @@ Browsers are fairly verbose with regard to HTTP request headers. The total bytes
5757

5858
## Choose a bundling and minification strategy
5959

60-
The MVC and Razor Pages project templates provide an out-of-the-box solution for bundling and minification consisting of a JSON configuration file. Third-party tools, such as the [Grunt](xref:client-side/using-grunt) task runner, accomplish the same tasks with a bit more complexity. A third-party tool is a great fit when your development workflow requires processing beyond bundling and minification&mdash;such as linting and image optimization. By using design-time bundling and minification, the minified files are created prior to the app's deployment. Bundling and minifying before deployment provides the advantage of reduced server load. However, it's important to recognize that design-time bundling and minification increases build complexity and only works with static files.
60+
The MVC and Razor Pages project templates provide a solution for bundling and minification consisting of a JSON configuration file. Third-party tools, such as the [Grunt](xref:client-side/using-grunt) task runner, accomplish the same tasks with a bit more complexity. A third-party tool is a great fit when your development workflow requires processing beyond bundling and minification&mdash;such as linting and image optimization. By using design-time bundling and minification, the minified files are created prior to the app's deployment. Bundling and minifying before deployment provides the advantage of reduced server load. However, it's important to recognize that design-time bundling and minification increases build complexity and only works with static files.
6161

6262
## Configure bundling and minification
6363

@@ -90,109 +90,6 @@ Configuration options include:
9090
* `sourceMap`: Flag indicating whether to generate a source map for the bundled file. **optional**, *default - false*
9191
* `sourceMapRootPath`: The root path for storing the generated source map file.
9292

93-
## Build-time execution of bundling and minification
94-
95-
The [BuildBundlerMinifier](https://www.nuget.org/packages/BuildBundlerMinifier/) NuGet package enables the execution of bundling and minification at build time. The package injects [MSBuild Targets](/visualstudio/msbuild/msbuild-targets) which run at build and clean time. The *bundleconfig.json* file is analyzed by the build process to produce the output files based on the defined configuration.
96-
97-
> [!NOTE]
98-
> BuildBundlerMinifier belongs to a community-driven project on GitHub for which Microsoft provides no support. Issues should be filed [here](https://github.com/madskristensen/BundlerMinifier/issues).
99-
100-
# [Visual Studio](#tab/visual-studio)
101-
102-
Add the *BuildBundlerMinifier* package to your project.
103-
104-
Build the project. The following appears in the Output window:
105-
106-
```console
107-
1>------ Build started: Project: BuildBundlerMinifierApp, Configuration: Debug Any CPU ------
108-
1>
109-
1>Bundler: Begin processing bundleconfig.json
110-
1> Minified wwwroot/css/site.min.css
111-
1> Minified wwwroot/js/site.min.js
112-
1>Bundler: Done processing bundleconfig.json
113-
1>BuildBundlerMinifierApp -> C:\BuildBundlerMinifierApp\bin\Debug\netcoreapp2.0\BuildBundlerMinifierApp.dll
114-
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
115-
```
116-
117-
Clean the project. The following appears in the Output window:
118-
119-
```console
120-
1>------ Clean started: Project: BuildBundlerMinifierApp, Configuration: Debug Any CPU ------
121-
1>
122-
1>Bundler: Cleaning output from bundleconfig.json
123-
1>Bundler: Done cleaning output file from bundleconfig.json
124-
========== Clean: 1 succeeded, 0 failed, 0 skipped ==========
125-
```
126-
127-
# [.NET Core CLI](#tab/netcore-cli)
128-
129-
Add the *BuildBundlerMinifier* package to your project:
130-
131-
```dotnetcli
132-
dotnet add package BuildBundlerMinifier
133-
```
134-
135-
If using ASP.NET Core 1.x, restore the newly added package:
136-
137-
```dotnetcli
138-
dotnet restore
139-
```
140-
141-
Build the project:
142-
143-
```dotnetcli
144-
dotnet build
145-
```
146-
147-
The following appears:
148-
149-
```console
150-
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
151-
Copyright (C) Microsoft Corporation. All rights reserved.
152-
153-
154-
Bundler: Begin processing bundleconfig.json
155-
Bundler: Done processing bundleconfig.json
156-
BuildBundlerMinifierApp -> C:\BuildBundlerMinifierApp\bin\Debug\netcoreapp2.0\BuildBundlerMinifierApp.dll
157-
```
158-
159-
Clean the project:
160-
161-
```dotnetcli
162-
dotnet clean
163-
```
164-
165-
The following output appears:
166-
167-
```console
168-
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
169-
Copyright (C) Microsoft Corporation. All rights reserved.
170-
171-
172-
Bundler: Cleaning output from bundleconfig.json
173-
Bundler: Done cleaning output file from bundleconfig.json
174-
```
175-
176-
---
177-
178-
## Ad hoc execution of bundling and minification
179-
180-
It's possible to run the bundling and minification tasks on an ad hoc basis, without building the project. Add the [BundlerMinifier.Core](https://www.nuget.org/packages/BundlerMinifier.Core/) NuGet package to your project:
181-
182-
[!code-xml[](../client-side/bundling-and-minification/samples/BuildBundlerMinifierApp/BuildBundlerMinifierApp.csproj?range=10)]
183-
184-
> [!NOTE]
185-
> BundlerMinifier.Core belongs to a community-driven project on GitHub for which Microsoft provides no support. Issues should be filed [here](https://github.com/madskristensen/BundlerMinifier/issues).
186-
187-
This package extends the .NET Core CLI to include the *dotnet-bundle* tool. The following command can be executed in the Package Manager Console (PMC) window or in a command shell:
188-
189-
```dotnetcli
190-
dotnet bundle
191-
```
192-
193-
> [!IMPORTANT]
194-
> NuGet Package Manager adds dependencies to the *.csproj file as `<PackageReference />` nodes. The `dotnet bundle` command is registered with the .NET Core CLI only when a `<DotNetCliToolReference />` node is used. Modify the *.csproj file accordingly.
195-
19693
## Add files to workflow
19794

19895
Consider an example in which an additional *custom.css* file is added resembling the following:
@@ -252,32 +149,7 @@ The following `environment` tag renders the bundled and minified CSS files when
252149
253150
There are cases in which an app's bundling and minification workflow requires additional processing. Examples include image optimization, cache busting, and CDN asset processing. To satisfy these requirements, you can convert the bundling and minification workflow to use Gulp.
254151
255-
### Use the Bundler & Minifier extension
256-
257-
The Visual Studio [Bundler & Minifier](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier) extension handles the conversion to Gulp.
258-
259-
> [!NOTE]
260-
> The Bundler & Minifier extension belongs to a community-driven project on GitHub for which Microsoft provides no support. Issues should be filed [here](https://github.com/madskristensen/BundlerMinifier/issues).
261-
262-
Right-click the *bundleconfig.json* file in Solution Explorer and select **Bundler & Minifier** > **Convert To Gulp...**:
263-
264-
![Convert To Gulp context menu item](../client-side/bundling-and-minification/_static/convert-to-gulp.png)
265-
266-
The *gulpfile.js* and *package.json* files are added to the project. The supporting [npm](https://www.npmjs.com/) packages listed in the *package.json* file's `devDependencies` section are installed.
267-
268-
Run the following command in the PMC window to install the Gulp CLI as a global dependency:
269-
270-
```console
271-
npm i -g gulp-cli
272-
```
273-
274-
The *gulpfile.js* file reads the *bundleconfig.json* file for the inputs, outputs, and settings.
275-
276-
[!code-javascript[](../client-side/bundling-and-minification/samples/BuildBundlerMinifierApp/gulpfile.js?range=1-12&highlight=10)]
277-
278-
### Convert manually
279-
280-
If Visual Studio and/or the Bundler & Minifier extension aren't available, convert manually.
152+
### Manually convert the bundling and minification workflow to use Gulp
281153
282154
Add a *package.json* file, with the following `devDependencies`, to the project root:
283155

aspnetcore/fundamentals/host/generic-host.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ uid: fundamentals/host/generic-host
1212

1313
::: moniker range=">= aspnetcore-3.0 <= aspnetcore-3.1"
1414

15-
The ASP.NET Core templates create a .NET Core Generic Host (<xref:Microsoft.Extensions.Hosting.HostBuilder>).
15+
The ASP.NET Core templates create a .NET Core Generic Host, <xref:Microsoft.Extensions.Hosting.HostBuilder>.
1616

1717
## Host definition
1818

@@ -34,7 +34,7 @@ The host is typically configured, built, and run by code in the `Program` class.
3434
* Calls a `CreateHostBuilder` method to create and configure a builder object.
3535
* Calls `Build` and `Run` methods on the builder object.
3636

37-
The ASP.NET Core web templates generate the following code to create a host:
37+
The ASP.NET Core web templates generate the following code to create a Generic Host:
3838

3939
```csharp
4040
public class Program
@@ -53,7 +53,7 @@ public class Program
5353
}
5454
```
5555

56-
The following code creates a non-HTTP workload with a `IHostedService` implementation added to the DI container.
56+
The following code creates a Generic Host using non-HTTP workload. The `IHostedService` implementation is added to the DI container:
5757

5858
```csharp
5959
public class Program
@@ -83,6 +83,8 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
8383
});
8484
```
8585

86+
The preceding code is generated by the ASP.NET Core templates.
87+
8688
If the app uses Entity Framework Core, don't change the name or signature of the `CreateHostBuilder` method. The [Entity Framework Core tools](/ef/core/miscellaneous/cli/) expect to find a `CreateHostBuilder` method that configures the host without running the app. For more information, see [Design-time DbContext Creation](/ef/core/miscellaneous/cli/dbcontext-creation).
8789

8890
## Default builder settings

aspnetcore/grpc/browser/sample/CORS_Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public void ConfigureServices(IServiceCollection services)
88
builder.AllowAnyOrigin()
99
.AllowAnyMethod()
1010
.AllowAnyHeader()
11-
.WithExposedHeaders("Grpc-Status", "Grpc-Message");
11+
.WithExposedHeaders("Grpc-Status", "Grpc-Message", "Grpc-Encoding", "Grpc-Accept-Encoding");
1212
}));
1313
}
1414

0 commit comments

Comments
 (0)