Skip to content

Migrate SampleMvcWebApp from .NET Framework 4.5.1 (ASP.NET MVC5) to .NET 8#16

Open
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin/1776263168-dotnet8-migration
Open

Migrate SampleMvcWebApp from .NET Framework 4.5.1 (ASP.NET MVC5) to .NET 8#16
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin/1776263168-dotnet8-migration

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 15, 2026

Summary

Full migration of the SampleMvcWebApp from .NET Framework 4.5.1 / ASP.NET MVC5 to .NET 8 / ASP.NET Core MVC. The solution compiles successfully (dotnet build — 0 errors, 0 warnings) and runs cross-platform via dotnet run --project SampleWebApp.

What changed across all 4 project layers:

Area Before After
Target framework .NET Framework 4.5.1 net8.0
Project format Old MSBuild + packages.config SDK-style .csproj + PackageReference
ORM Entity Framework 6 (SQL Server/LocalDB) EF Core 8 (SQLite)
DI container Autofac Microsoft.Extensions.DependencyInjection
CRUD library GenericServices + AutoMapper Removed — manual EF Core queries in controllers
Configuration Web.config appsettings.json
Startup Global.asax + App_Start/ Program.cs (minimal hosting model)
Views MVC5 Html helpers + Bundles Mix of tag helpers and Html helpers; CDN for Bootstrap/jQuery
Logging log4net / Trace Removed (ASP.NET Core built-in logging configured)

Deleted files (non-exhaustive):

  • All packages.config, App.config, AssemblyInfo.cs, Web.config, Web.*.config
  • Global.asax, Global.asax.cs, App_Start/ (BundleConfig, RouteConfig, FilterConfig)
  • Autofac modules (AutofacDi.cs, DiModelBinder.cs, *Module.cs)
  • MVC5 infrastructure (WebUiInitialise.cs, Log4NetGenericLogger.cs, TraceGenericLogger.cs, JsonNetResult.cs)
  • GenericServices editor templates (EditorTemplates/)

Added files:

  • Program.cs, appsettings.json, appsettings.Development.json
  • _ViewImports.cshtml, wwwroot/css/site.css
  • DataLayerServiceCollectionExtensions.cs, ServiceLayerServiceCollectionExtensions.cs

Local testing screenshots

Home page:
Home page

Posts page (with seeded data):
Posts page

Tags page:
Tags page

Updates since initial commit

  • Fixed runtime crash in LoadDbDataFromXml.cs: The XML seed data files use child elements (<Name>, <Slug>, etc.), not attributes. The initial rewrite incorrectly used .Attribute() instead of .Element(), causing a NullReferenceException at startup during database seeding. Fixed in second commit.

Review & Testing Checklist for Human

  • All controller CRUD logic was hand-rewritten (replaced GenericServices). Carefully review PostsController, PostsAsyncController, and BlogsController for correctness — especially the Edit actions that handle related entities (Bloggers dropdown, Tags multi-select). The DTO population and save-back logic is the highest-risk area. Verify by exercising the Post create/edit/delete flow end-to-end.
  • Database provider changed from SQL Server to SQLite — this was done to enable cross-platform development but changes runtime behavior. Verify this is acceptable for your needs, or swap to UseSqlServer() with an appropriate connection string.
  • Tests project was NOT migrated — only its config files were cleaned up. The Tests.csproj still references the old format and is excluded from the build. No automated tests were run against the new code.
  • XML parsing was initially broken (fixed in second commit). Given that the XML parsing was rewritten incorrectly once, review LoadDbDataFromXml.cs carefully and verify the seed data loads completely (all blogs, posts, and tags).
  • Verify Post create/edit form binding — the DetailPostDto / DetailPostDtoAsync classes use custom DropDownListType and MultiSelectListType for Blogger selection and Tag multi-select. These are populated manually in controllers and rendered via custom markup in the views. Test that form POST model binding round-trips correctly.

Recommended test plan: Run dotnet run --project SampleWebApp, then exercise: (1) list posts, (2) create a new post with blogger and tags, (3) edit an existing post, (4) delete a post, (5) repeat for Tags and Blogs pages, (6) try the async variants (/PostsAsync, /TagsAsync).

Notes

  • InternalsInfo.AvailableMbytes was removed because PerformanceCounter is Windows-only. The Internals view was updated accordingly — this is a minor functionality loss.
  • Many views still use @Html.ActionLink, @Html.BeginForm, @Html.EditorFor etc. These work in ASP.NET Core but are not fully converted to tag helpers. Only the Post edit/create forms and the layout were converted to tag helpers.
  • CI shows Snyk security/license check failures — these are not required checks and are external scans, not build failures. The PR remains mergeable.

Link to Devin session: https://app.devin.ai/sessions/5d833fd90ac2449693a89e1d2cdfc16a
Requested by: @achalc

…NET 8

- Convert all 4 projects to SDK-style .csproj targeting net8.0
- Migrate EF6 to EF Core 8 with SQLite provider
- Replace Autofac DI with Microsoft.Extensions.DependencyInjection
- Replace Global.asax with Program.cs (minimal hosting model)
- Replace Web.config with appsettings.json
- Update Razor views with ASP.NET Core tag helpers and conventions
- Refactor GenericServices DTOs to plain DTOs
- Update all controllers to ASP.NET Core MVC with constructor injection
- Remove obsolete files (packages.config, AssemblyInfo.cs, App_Start, etc.)

Co-Authored-By: Achal Channarasappa <achal.channarasappa@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

…ute()

The XML seed data files use child elements (<Name>, <Slug>, etc.) not
attributes. This caused a NullReferenceException at startup during
database seeding.

Co-Authored-By: Achal Channarasappa <achal.channarasappa@cognition.ai>
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.

1 participant