Skip to content
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

Migrate from 2.0 to 2.1 #6612

Merged
merged 14 commits into from
May 30, 2018
Merged

Migrate from 2.0 to 2.1 #6612

merged 14 commits into from
May 30, 2018

Conversation

Rick-Anderson
Copy link
Contributor

@Rick-Anderson Rick-Anderson commented May 26, 2018

@Rick-Anderson Rick-Anderson changed the title WIP Migrate from 2.0 to 2.1 Migrate from 2.0 to 2.1 May 26, 2018
@Rick-Anderson
Copy link
Contributor Author

Rick-Anderson commented May 26, 2018

@scottaddie do you remember how @danroth27 wanted to TOC. IIRC, he wanted the #Migration to go to this page rather than the index page - But I think this works better.


[!code-csharp[Main](20_21/sample/Program.cs?name=snippet)]

The new `Main` replaces the call to `BuildWebHost` with [CreateWebHostBuilder](/dotnet/api/microsoft.aspnetcore.mvc.testing.webapplicationfactory-1.createwebhostbuilder?view=aspnetcore-2.1#Microsoft_AspNetCore_Mvc_Testing_WebApplicationFactory_1_CreateWebHostBuilder). [WebHostBuilder](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.webhostbuilder?view=aspnetcore-2.0) was introduced to make it easier to write integration tests. For more information, see [Integration tests](xref:test/integration-tests) and [Razor Pages unit and integration tests](xref:test/razor-pages-tests).
Copy link
Collaborator

@guardrex guardrex May 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

U can take the CreateWebHostBuilder API link down to ...

[CreateWebHostBuilder](/dotnet/api/microsoft.aspnetcore.mvc.testing.webapplicationfactory-1.createwebhostbuilder)

Instead of the concrete WebHostBuilder, describe the interface ...

[IWebHostBuilder](/dotnet/api/microsoft.aspnetcore.hosting.iwebhostbuilder)

I view the introduction of IWebHostBuilder for integration tests as an esoteric implementation detail, so I don't surface the reason for its existence or its mechanics in the topic. That may change on review, but I hope not given the length and complexity of the topic. Therefore, I recommend (at least today) that you strip the last two sentences and remove the cross-link that to the testing topics. If you want to keep it tho, I recommend it go like this ...

[IWebHostBuilder](/dotnet/api/microsoft.aspnetcore.hosting.iwebhostbuilder) is introduced to support new [integration test infrastructure](xref:test/integration-tests).

... that way it doesn't suggest that they'll get further explanation on it in the test topic.


## Update the project file to use 2.1 versions

Update the *.csproj* project file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't there a before and after picture for the project file migration as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidfowl I added the before/after csproj files. Also added the before/after pic which I think is a distraction and we should remove. It's so lit up it doesn't tell you much.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't think we need both the diff images and the before and after examples. I think the diff images can be removed.

{
if (env.IsDevelopment())
{
// app.UseBrowserLink();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this, why is it commented out?


The following code shows the changes to 2.1 template generated code. All changes are newly added code, except that `UseBrowserLink` has been removed:

[!code-csharp[Main](20_21/sample/Startup.cs?highlight=3,4,21-26,30,45,47)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a highlight on UseHsts.

* *Pages/_Layout.cshtml* moves to *Pages/Shared/_Layout.cshtml*
* The *Layout.cshtml* file has the following changes:

* `<partial name="_CookieConsentPartial" />` is added.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backreference to GDPR support

@Tratcher
Copy link
Member

Where's the upsell 😁? This covers the mechanical conversion well, but it doesn't tell me why I should upgrade. I'd expect a short intro paragraph on the new features in 2.1 (not just the ones that required template changes), or at least a link to the 2.1 blog posts.

* Change `<TargetFramework>netcoreapp2.0</TargetFramework>` to the 2.1 version, that is `<TargetFramework>netcoreapp2.1</TargetFramework>`.
* Replace the version specified "Microsoft.AspNetCore.All" package reference with the versionless "Microsoft.AspNetCore.App" package reference. See [Migrating from Microsoft.AspNetCore.All to Microsoft.AspNetCore.App](xref:fundamentals/metapackage#migrate) and [Microsoft.AspNetCore.App metapackage](xref:fundamentals/metapackage-app).
* Remove all references to `<DotNetCliToolReference>` elements for "Microsoft.AspNetCore", "Microsoft.VisualStudio", and "Microsoft.EntityFrameworkCore" packages. These tools have been replaced by global tools.
* Remove the `<DotNetCliToolReference>` elements for any "Microsoft.AspNetCore" packages. These have been replaced by global tools.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is covered by the previous bullet.


## Update the project file to use 2.1 versions

Update the *.csproj* project file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't think we need both the diff images and the before and after examples. I think the diff images can be removed.


This article provides an overview on migration to ASP.NET Core 2.1. It does not contain a complete list of all changes needed to migrate to version 2.1. Some projects might require more steps depending on the options selected when the project was created and modifications made to the project.

## Update the project file to use 2.1 versions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add a couple of steps here:

  • If you switch from .All to .App you may need to add back dependencies that were removed from .App.
  • If you are targetting the the .NET Framework, then you will have individual package references instead of a meta package reference, which all need to be updated to 2.1.

@Rick-Anderson
Copy link
Contributor Author

@danroth27 ready to merge?

Copy link
Member

@danroth27 danroth27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Rick-Anderson Rick-Anderson merged commit fa588a8 into master May 30, 2018
@Rick-Anderson Rick-Anderson deleted the 21migrateFrom20/ra branch May 30, 2018 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants