-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
Migrate from 2.0 to 2.1 #6612
Conversation
@scottaddie do you remember how @danroth27 wanted to TOC. IIRC, he wanted the |
aspnetcore/migration/20_21.md
Outdated
|
||
[!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). |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
aspnetcore/migration/20_21.md
Outdated
|
||
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)] |
There was a problem hiding this comment.
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.
aspnetcore/migration/20_21.md
Outdated
* *Pages/_Layout.cshtml* moves to *Pages/Shared/_Layout.cshtml* | ||
* The *Layout.cshtml* file has the following changes: | ||
|
||
* `<partial name="_CookieConsentPartial" />` is added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backreference to GDPR support
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. |
aspnetcore/migration/20_21.md
Outdated
* 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. |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
@danroth27 ready to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #6404
Review URL