Skip to content

Commit

Permalink
more migrations details (#14835)
Browse files Browse the repository at this point in the history
* more migrations details

* work

* work

* Apply suggestions from code review

Co-Authored-By: Scott Addie <10702007+scottaddie@users.noreply.github.com>

* Update aspnetcore/migration/22-to-30.md

Co-Authored-By: Scott Addie <10702007+scottaddie@users.noreply.github.com>

* Update aspnetcore/migration/22-to-30.md

Co-Authored-By: Scott Addie <10702007+scottaddie@users.noreply.github.com>
  • Loading branch information
Rick-Anderson and scottaddie committed Oct 9, 2019
1 parent 74de68c commit c7520da
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 3 deletions.
67 changes: 64 additions & 3 deletions aspnetcore/migration/22-to-30.md
Expand Up @@ -47,13 +47,46 @@ If your solution relies upon a [global.json](/dotnet/core/tools/global-json) fil

ASP.NET Core 3.0 and later only run on .NET Core. Set the [Target Framework Moniker (TFM)](/dotnet/standard/frameworks) to `netcoreapp3.0`:

[!code-xml[](22-to-30/samples/Web1.csproj?highlight=4)]

### Remove obsolete package references

ASP.NET Core no longer produces a large number of NuGet packages features. These package references should be removed from your project file. For example, the template-generated project file for an ASP.NET Core 2.2 web app:

```xml
<TargetFramework>netcoreapp3.0</TargetFramework>
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
</ItemGroup>

</Project>
```

### Remove obsolete package references
The updated ASP.NET Core 3.0 project file:

[!code-xml[](22-to-30/samples/Web1.csproj?highlight=4)]

The updated ASP.NET Core 3.0 project file:

ASP.NET Core no longer produces a large number of NuGet packages features. These package references should be removed from your project file. To see the full list of packages that are no longer produced, see below:
* In the `<PropertyGroup>`:

* Updates the TFM to `netcoreapp3.0`
* Removes the `<AspNetCoreHostingModel>` element. For more information, see [In-process hosting model](#in-process-hosting-model) in this document.

* In the `<ItemGroup>`:

* `Microsoft.AspNetCore.App` is removed. For more information, see [Framework reference](#framework-reference) in this document.
* `Microsoft.AspNetCore.Razor.Design` is removed and in the following list of packages no longer being produced.

To see the full list of packages that are no longer produced, select the following expand list:

<details>
<summary>Click here to expand the list of packages no longer being produced</summary>
Expand Down Expand Up @@ -210,6 +243,10 @@ If your app is using docker, use a base image that includes ASP.NET Core 3.0. Fo

ASP.NET Core 3.0 removes some assemblies that were previously part of the `Microsoft.AspNetCore.App` package reference. To continue using features provided by these assemblies, reference the 3.0 versions of the corresponding packages:

* A template-generated web app with **Individual User Accounts** requires adding the following packages:

[!code-xml[](22-to-30/samples/WebFull.csproj?highlight=9-13)]

* [Microsoft.EntityFrameworkCore](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore)

For more information on referencing the database provider-specific package, see [Database Providers](/ef/core/providers/index).
Expand Down Expand Up @@ -239,6 +276,26 @@ ASP.NET Core 3.0 removes some assemblies that were previously part of the `Micro

* MVC `Newtonsoft.Json` support &ndash; Support for using MVC with `Newtonsoft.Json` is now part of [Microsoft.AspNetCore.Mvc.NewtonsoftJson](https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.NewtonsoftJson).

## Startup changes

The following image shows the deleted and changed lines in an ASP.NET Core 2.2 Razor Pages Web app:

![the deleted and changed lines in an ASP.NET Core 2.2 Razor Web app](22-to-30/_static/startup2.2.png)

In the preceding image, deleted code is shown in red. The deleted code doesn't show cookie options code, which was deleted prior to comparing the files.

The following image shows the added and changed lines in an ASP.NET Core 3.0 Razor Pages Web app:

![the added and changed lines in an ASP.NET Core 3.0 Razor Web app](22-to-30/_static/startup3.0.png)

In the preceding image, added code is shown in green. For information on the following changes:

* `services.AddMvc` to `services.AddRazorPages`, see [MVC service registration](#mvc-service-registration) in this document.
* `CompatibilityVersion`, see <xref:mvc/compatibility-version>.
* `IHostingEnvironment` to `IWebHostEnvironment`, see [this GitHub announcement](https://github.com/aspnet/AspNetCore/issues/7749).
* `app.UseAuthorization` was added to the templates to show the order authorization middleware must be added. If the app doesn't use authorization, you can safely remove the call to `app.UseAuthorization`.
* `app.UseEndpoints`, see [Razor Pages](#razor-pages) or [Migrate Startup.Configure](#migrate-startupconfigure) in this document.

### Analyzer support

Projects that target `Microsoft.NET.Sdk.Web` implicitly reference analyzers previously shipped as part of the [Microsoft.AspNetCore.Mvc.Analyzers](https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.Analyzers/) package. No additional references are required to enable these.
Expand Down Expand Up @@ -1109,6 +1166,10 @@ var webRootFileProvider =
#endif
```

### Publish

Delete the *bin* and *obj* folders in the project directory.

<a name="break"></a>

## Breaking API changes
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions aspnetcore/migration/22-to-30/samples/Web1.csproj
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

</Project>
16 changes: 16 additions & 0 deletions aspnetcore/migration/22-to-30/samples/WebFull.csproj
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UserSecretsId>My-secret</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0" />
</ItemGroup>

</Project>

0 comments on commit c7520da

Please sign in to comment.