
Description
Migrates .NET projects from System.Messaging to MSMQ.Messaging for .NET Core compatibility. Use when upgrading projects that reference System.Messaging, MessageQueue, XmlMessageFormatter, or when migrating MSMQ queue code from .NET Framework to .NET Core/.NET 5+. Also triggers for queue configuration migration from web.config/app.config to appsettings.json and replacing ConfigurationManager with dependency injection for queue settings.
SKILL.md
System.Messaging to MSMQ Migration
Migrate .NET projects from System.Messaging to MSMQ.Messaging for .NET Core compatibility. The APIs are nearly identical (same class names, different namespace), so migration focuses on reference updates, configuration changes, and dependency injection adoption.
Workflow
First verify the project actually uses System.Messaging. If it does not, inform the user there is nothing to do.
Task Progress:
- [ ] Step 1: Remove System.Messaging references
- [ ] Step 2: Update using statements and code
- [ ] Step 3: Migrate queue configuration
- [ ] Step 4: Verify and clean up
Step 1: Remove System.Messaging References
Remove System.Messaging assembly references from project files (.csproj/.vbproj). These are not needed because MSMQ.Messaging provides the replacement types.
Step 2: Update Using Statements and Code
Find all usages of System.Messaging in the project and update them:
- Replace
using System.Messagingwithusing MSMQ.Messagingin all files - Update
MessageQueue,Message, andXmlMessageFormatterusage to the MSMQ.Messaging equivalents (same class names, different namespace — see API Mapping below) - Update message sending/receiving code for any MSMQ API differences in method signatures or properties
- If method signatures changed, update all callers across the solution
Step 3: Migrate Queue Configuration
Move queue settings from web.config/app.config to appsettings.json because ConfigurationManager is not available in .NET Core — configuration must use the options pattern with dependency injection instead.
appsettings.json:
{
"MessageQueue": {
"QueuePath": "./private$/myqueue"
}
}
Configuration model class:
public class MessageQueueOptions
{
public string QueuePath { get; set; }
}
Registration in Program.cs:
builder.Services.Configure<MessageQueueOptions>(
builder.Configuration.GetSection("MessageQueue"));
Inject IOptions<MessageQueueOptions> into classes that need queue configuration, replacing any ConfigurationManager usage.
Step 4: Verify and Clean Up
Build the project and search for any remaining System.Messaging references. Fix any remaining compilation errors.
API Mapping
| System.Messaging | MSMQ.Messaging |
|---|---|
MessageQueue | MessageQueue (same name, different namespace) |
Message | Message (same name, different namespace) |
XmlMessageFormatter | XmlMessageFormatter (same name, different namespace) |
Success Criteria
- No remaining
System.Messagingreferences - All queue code uses
MSMQ.Messaging - Queue configuration in
appsettings.json(not web.config/app.config) - Configuration accessed via dependency injection (no
ConfigurationManager) - Project builds without errors
More skills from the upgrade-agent-plugins repository
View all 19 skillsconverting-to-cpm
migrate .NET projects to Central Package Management
Jul 18.NETMicrosoftMigrationcreating-winforms-custom-controls
create custom WinForms controls
Jul 3.NETWindowsWinUImanaging-winforms-high-dpi-layout
design high-DPI responsive WinForms layouts
Jul 18DesignDesktopUI ComponentsWindowsmanaging-winforms-mvvm
implement MVVM pattern in WinForms
Jul 18.NETWindowsWinUImigrating-aspnet-framework-to-core
migrate ASP.NET Framework to Core
Jul 3.NETASP.NET CoreBackendMigrationmigrating-documentdb-to-cosmos
migrate DocumentDB to Cosmos DB
Jul 3AzureCosmos DBDatabaseMigration
More from Microsoft
View publisherplaywright-trace
inspect Playwright trace files
playwright
Apr 6DebuggingPlaywrightTestingrushstack-best-practices
manage Rush monorepos with best practices
rushstack
Apr 6EngineeringLocal DevelopmentMicrosoftProject Management +1azure-ai-agents-persistent-dotnet
build AI agents with Azure .NET SDK
skills
Jul 3.NETAgentsAzureLLMazure-ai-anomalydetector-java
build anomaly detection applications with Java
skills
May 13AnalyticsAzureData AnalysisJava +2azure-ai-contentsafety-java
build content moderation applications with Azure AI
skills
Jul 7AI InfrastructureAzureJavaSecurityazure-ai-contentsafety-py
detect harmful content with Azure AI Content Safety
skills
Jul 18AzureComplianceLLMMicrosoft +2