3 ms·
As someone coming from Node who has only recently (with .NET 6) taken a good look at the ecosystem, it appears to me that there have been a lot of breaking chan
by sylens 5y ago
As someone coming from Node who has only recently (with .NET 6) taken a good look at the ecosystem, it appears to me that there have been a lot of breaking changes to get where they are now.
On one hand, I love that they’re trying to reduce boilerplate and align closer to something like Node with Minimal APIs. On the other hand, nearly every reference guide or tutorial I look up is outdated and I’m left trying to figure out what changed between .NET 5 (or earlier) and .NET 6. I was following the Little ASP.NET Core book one day and things like there being no Startup.cs anymore (being merged into Program.cs) took me a minute to figure out, as there’s also no definitive resource for a newcomer on what has changed that would make older documentation inaccurate.
- Hawxy 5y ago> as there’s also no definitive resource for a newcomer on what has changed that would make older documentation inaccurate. The two pages you want are: https://docs.microsoft.com/en-us/aspnet/core/migration/50-to-60 https://docs.microsoft.com/en-us/aspnet/core/migration/50-to... and https://docs.microsoft.com/en-us/aspnet/core/migration/50-to-60-samples https://docs.microsoft.com/en-us/aspnet/core/migration/50-to... Both should cover the majority of scenarios. The main takeaway is that everything you usually configure in `ConfigureServices` now hangs off `builder.Services`, and everything you'd configure in the middleware pipeline `Configure(IApplicationBuilder app)` is available after you call `var app = builder.Build();`. I'll note that the change to the Minimal API was only in the project templates, so the old model does continue to work without any breaking changes.
- smarx007 5y agoIs there an up-to-date guide for migrating from .NET Framework 4.8 to .NET Core 6.0 (or whatever the latest LTS is)? I guess many projects have not yet migrated, especially libraries that wanted to stay compatible.
- throwaway6532 5y agoUpgrading usually requires an enormous amount of remediation work before it's even possible. Generally you can do it like this - convert to PackageReference style NuGet packages (this one alone may even be a blocker if you have certain unfortunate dependencies which aren't compatible with PackageReference), upgrade all your dependencies to a netstandard2.x compatible version (this is often brutally difficult in a big system and you may have to replace certain dependencies outright), start swapping out DI / Logging etc with the netstandard equivalents found in .NET Core, create a new .NET Core solution file and try to compile your project to see what breaks and fix any remaining issues. Having done this it does work, but it's fairly time consuming and for larger apps virtually impossible without massive buy-in from the business.
- jcon321 5y agoFrom my understanding, that's not really a migratable stack. Depending on what you're doing in 4.8 (aspx, wpf, aka windows only type stuff) there's not a direct migration. It's more of a re-write.
- jbergens 5y agoI think you are only kind of right. aspx is over 10 years old, you should have switched to .NET MVC already and then the difference to .NET Core is small. We rewrote some things at an earlier company and there mostly general things like auth and where to get querystring variables and similar that had changed. If we look at WCF to REST (or gRPC) it is also mainly easy since it is some general configurations and infrastructure things that have changed but most of the business logic will work. So you have to rewrite but it might be quite easy. And doing this once every decade is not that strange. Also remember that most of the old things still work. You can stay on those tech stacks for another couple of years if you feel that is better for your organization.
- electroly 5y agoWPF wasn't left behind. It's still supported in .NET 6, you don't have to rewrite anything. Windows Forms, too. Can you be more specific what you mean by aspx? ASP.NET is, of course, still supported. https://docs.microsoft.com/en-us/dotnet/core/porting/net-framework-tech-unavailable https://docs.microsoft.com/en-us/dotnet/core/porting/net-fra...
- hackerfromthefu 5y agoAspx is the file extension of Web Forms pages, which have no direct migration path to .net core/6.
- electroly 5y agoAh, of course. Thank you!
- jve 5y ago.NET 3.5 SP1 support ends Jan 9, 2029. For .NET 4.8 there currently there is no support end date. Don't think it's gonna be sooner than 3.5. > .NET Framework 4.8 is the latest version of .NET Framework and will continue to be distributed with future releases of Windows. As long as it is installed on a supported version of Windows, .NET Framework 4.8 will continue to also be supported. https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-framework https://dotnet.microsoft.com/en-us/platform/support/policy/d... I think for new apps, you should choose .NET Core. But for legacy apps, I suppose you can take your time. .NET Core actually has much shorter LTS lifecycle. Only 3 years: https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core https://dotnet.microsoft.com/en-us/platform/support/policy/d... In our case, a fairly big monolith .NET 4.8 web app is being migrated to .NET Core by splitting that monolith into microservices that run on .NET Core. Can't say if it is for better or worse, more moving parts in infrastructure for sure.
- NicoJuicy 5y agoPut the API behind a gateway and migrate the modules to the .net core API. ( Doing something similar, but I'm not going to go with Microservices)
- mattferderer 5y agoIt really depends on your project & how your code is split up. A lot of business type logic code should be identical. I've migrated a couple decade plus old web form projects. A lot of the business logic can be moved to .NET Core 6 verbatim. I'll often set up a new version & slowly proxy web requests from the old site to a new version of the site as we update it.
- sylens 5y agoThank you for this. That first one in particular is probably exactly what I needed. I guess the one downside of having lots of documentation (and third party guides/tutorials) is that it may take some time to update when there are significant changes
- thrower123 5y agoI really don't understand the obsession the ASPNET team has with minimal APIs. I'm firmly in the camp of wanting things to be explicit rather than implicit, because it gets difficult to keep implicit conventions in your head as things shift and melt chasing the latest fashions.
- hackerfromthefu 5y agoI think the easy to get started techs such as node ate their lunch for so long they felt they had to appeal to that market.
- jbergens 5y agoMost of the changes are not _breaking_. There are new ways to do things but the old still works. You can have both an api controller and a minimal api in the same application. I agree that it is hard to know which version a specific blog post or tutorials works for.
- lbriner 5y agoThat's not true, there are a lot of breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/compatibility/6.0 https://docs.microsoft.com/en-us/dotnet/core/compatibility/6... The problem is that Microsoft can never avoid the temptation to fix things that weren't that broken and leave it up to you to find the bugs later. Even a theoretical "non-breaking" change like adding some more constructors broke some of our code, previously, you could add ILoggerFactory really easily and it found a single default constructor in LoggerFactory and just worked. The new overloads cause most DI systems to look for the constructor with the most parameters, some of which are not available, and then fall over. MS need a better system for updates, every version has brought us a lot of headache although I can't really see us using anything else, which would be an enormous amount of work.
- Merad 5y agoA lot of the changes are aimed at making it easier for people to get started with Asp.Net, and most of those aren't breaking changes. Traditionally Asp.Net has had a lot of boilerplate around project setup and configuration, and things like minimal APIs aim to change that. The unfortunate side effect is that it adds more complexity (more ways to do the same thing) to the ecosystem, and the newer minimal approaches probably aren't what you're see used in the typical production project.
- mpmpmpmp 5y agoFor sure. There has been a lot of pushback in the community from both sides of that issue. They wanted to reduce the boilerplate and make it cleaner to make simpler projects (with the goal of enabling microservice scenarios). But that moved some people's cheese from the standpoint of what the recommended path is. The problem is that there's a huge amount of very good documentation on the microsoft documentation site, but it's not organized in a way that makes it easy to find.