migrating-mvc-dependency-injection

Migrate ASP.NET MVC and WebAPI dependency injection to ASP.NET Core.

19|2|Updated May 13, 2026
One-click install
npx skills add https://github.com/microsoft/upgrade-agent-plugins --skill migrating-mvc-dependency-injection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrating-mvc-dependency-injection
Source: https://github.com/microsoft/upgrade-agent-plugins/tree/main/plugins/upgrade-agent/extenders/upgrade-dotnet/upgrade/skills/lazy/web/mvc/migrating-mvc-dependency-injection
Command: npx skills add https://github.com/microsoft/upgrade-agent-plugins --skill migrating-mvc-dependency-injection

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill automates the process of upgrading ASP.NET MVC and WebAPI projects to use modern dependency injection (DI) patterns, simplifying the transition to ASP.NET Core.

Core Features & Use Cases

  • Automated DI Conversion: Migrates existing DI configurations to ASP.NET Core's built-in DI or integrates with modern third-party containers.
  • Custom Container Removal: Offers guidance on replacing third-party DI containers with built-in ASP.NET Core support.
  • Controller Factory Migration: Converts custom IControllerFactory and IHttpControllerActivator logic to ASP.NET Core's IControllerActivator.
  • Service Locator Elimination: Provides strategies for replacing the Service Locator pattern with constructor injection.
  • Use Case: For developers looking to upgrade an existing MVC or WebAPI application to ASP.NET Core while maintaining DI configurations.

Quick Start

Use the 'migrating-mvc-dependency-injection' skill to upgrade your MVC project's dependency injection to ASP.NET Core.

Frequently Asked Questions about migrating-mvc-dependency-injection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate custom controller factories to ASP.NET Core dependency injection?

To migrate controller factories to ASP.NET Core dependency injection, you convert custom IControllerFactory and IHttpControllerActivator logic to ASP.NET Core's IControllerActivator. This ensures your MVC and WebAPI controllers are properly resolved by the built-in DI container during project upgrades.

What is the best way to replace the Service Locator pattern when upgrading MVC projects?

The best way to replace the Service Locator pattern when upgrading MVC projects is to implement constructor injection. This migration strategy eliminates hidden dependencies by explicitly defining required services in your controller constructors within ASP.NET Core's built-in DI container.

Can I migrate existing MVC DI configurations to a modern third-party container?

Yes, you can migrate existing MVC DI configurations to a modern third-party container. The migration process supports integrating modern third-party DI containers or fully replacing them with ASP.NET Core's built-in DI support for streamlined dependency resolution.

Does ASP.NET Core dependency injection support removing custom third-party DI containers?

Yes, ASP.NET Core dependency injection supports removing custom third-party DI containers. The migration provides guidance on replacing third-party DI container configurations with built-in ASP.NET Core support, simplifying your WebAPI and MVC project architecture.

Why does migrating MVC dependency injection require updating old DI patterns?

Migrating MVC dependency injection requires updating old DI patterns because ASP.NET Core uses a built-in DI container with different resolution mechanisms. Converting legacy custom controller factories and Service Locator usage ensures compatibility with modern constructor injection standards.

What are the limitations when migrating WebAPI dependency resolution to ASP.NET Core?

Limitations when migrating WebAPI dependency resolution to ASP.NET Core include handling custom controller factories and Service Locator anti-patterns. You must manually convert IHttpControllerActivator logic to IControllerActivator and replace service location with constructor injection.