Dotnet Migration
LangChain Hub prompt: henriqueholtz/dotnet-migration
@{SLN_FILENAME} Help me migrate to .NET 10 the projects related to this solution following these instructions:
Act as an expert Senior .NET Architect and Principal Engineer specializing in large-scale framework migrations and performance tuning. Your task is to provide a comprehensive, step-by-step plan and code modifications for updating a full .NET solution from its current version (which is between 5 and 9) to .NET 10. The goal is to achieve a maximum performance gain while strictly adhering to modern .NET best practices and minimizing breaking changes.
1. Core Constraints and Scope:
- Target Framework: .NET 10 (or the latest available preview/RC if .NET 10 is not officially released).
- Goal: Achieve a complete, stable, and highly performant upgrade.
- Out of Scope: ABSOLUTELY NO CHANGES to existing business logic, application features, or external API contracts. The focus is purely on infrastructure, framework, and performance configuration.
- Deliverable Format: Provide the response as a detailed, numbered action plan with specific code examples for common migration points (e.g., in
.csprojfiles,Program.cs, and configuration files). - Ignore others projects that are not related to the selected solution
- DO NOT replace any packages by yourself. If required you should ask the user first
- Ask the user if he wants to upgrade nuget pacakges as well
- DO NOT add additional settings for projects (.csproj). If you want to you need to ask the user permission
- Make sure to update all Dockefile if there are.
2. Technical Focus Areas (MUST ADDRESS):
A. Project File (.csproj) Updates:
- Detail the minimum required changes to the
TargetFrameworkproperty. - Address modern SDK-style project references and implicit usings (if applicable and beneficial).
- Specify how to handle potential dependency conflicts (e.g., older versions of
Microsoft.Extensions.*orSystem.*packages) by recommending specific minimal-version updates.
B. Hosting and Startup Model (Web/API/Worker):
- Provide clear guidance on migrating from the Generic Host Builder to the Minimal Hosting Model (if not already using it), including the benefits and necessary changes to
Program.csandStartup.cs(if it still exists). - Address modern configuration management, focusing on best practices for IConfiguration, environment variables, and secrets management in .NET 10.
C. Performance and Efficiency Enhancements (CRITICAL):
- Identify and suggest adoption of .NET 10-specific APIs or features that offer significant performance improvements (e.g., new collections, Span usage in common patterns, or updates to Kestrel configuration).
- Focus on AOT (Ahead-of-Time) or Trimming configuration changes in the project file that are safe for a web application/service and detail the trade-offs (e.g., file size vs. compatibility).
- Recommend changes to garbage collection (GC) settings in the runtime configuration file (
runtimeconfig.json) for server environments.
D. Common Pitfalls and Troubleshooting:
- List the top 5 most common breaking changes encountered when moving to .NET 10 from previous versions.
- Provide a methodology for resolving common runtime exceptions related to reflection, serialization, or dependency injection after the upgrade.
3. Specific Code Example Request:
Provide a side-by-side comparison (or clear before/after code blocks) for migrating a typical Program.cs file from the Generic Host Builder to the Minimal API/Hosting Model in .NET 10, highlighting only the structural/infrastructure changes.
4. Final Section: Build and Test (NON-NEGOTIABLE)
- Provide explicit command-line instructions to clean, rebuild, and test the entire solution using the .NET CLI.
- Detail the methodology for verifying the build's integrity (e.g., checking dependency graphs and output assembly compatibility).
- Outline the steps required to ensure all existing unit, integration, and performance tests pass, including any necessary package updates for common testing frameworks like Xunit, NUnit, or MSTest.
- Specify how to verify the new performance configurations (AOT, Trimming, Kestrel) are active and correctly applied in the deployment environment.
5. Self-Correction and Review:
Before generating the final plan, review the suggested code changes to ensure zero impact on business logic and confirm that all recommendations align with the absolute latest .NET 10 documentation and security best practices.
How to Use
Use with LangChain: hub.pull("henriqueholtz/dotnet-migration")
Related Prompts
More prompts in Coding & Development
This Prompt Ads Sequential Function Calling To Models Other Than GPT 0613
This prompt ads sequential function calling to models other than GPT-0613
Create a personalized workout routine
Tailor a workout routine specifically designed for individual fitness goals
GODMODE CHEATCODE
God Writes You a Letter Today. This is will help you find the perfect Bible Scripture that will guide you through a current problem you're facing.
Creating a Personal Finance Tracker with [Technology/Tool]
Learn to create a personal finance tracker using [Technology/Tool]. Get code samples and budgeting tips.
Build an entire application using bubble.io with ChatGPT4
Build an entire app with bubble.io, assisted by chatGPT4, that knows bubble very well and is accurate 95% of the time. This prompt will help you maximize the quality of chatGPT assistance. Having detailed and step-by-step instructions is essential to progress fast with Bubble. This initial prompt will help you get started on a good basis. Follow it because I will make it even better.
Become LawyerGPT
Are you in a legal bind? This prompt can help you gain knowledge about how to handle your legal proceedings. DISCLAIMER: Please meet with a real lawyer to discuss your options.