Installing and updating NuGet packages in .NET Framework projects is a complex task requiring coordinated changes to multiple files. Therefore, do not attempt to install or update NuGet packages in this project.
Instead, if changes to NuGet references are required, ask the user to install or update NuGet packages using the Visual Studio NuGet Package Manager or Visual Studio package manager console.
When recommending NuGet packages, ensure they are compatible with .NET Framework or .NET Standard 2.0 (not only .NET Core or .NET 5+).
C# Language Version is 7.3
This project is limited to C# 7.3 features only. Please avoid using:
C# 8.0+ Features (NOT SUPPORTED):
Using declarations (using var stream = ...)
Await using statements (await using var resource = ...)
Switch expressions (variable switch { ... })
Null-coalescing assignment (??=)
Range and index operators (array[1..^1], array[^1])
Target-typed new expressions (List<string> list = new())
C# 10+ Features (NOT SUPPORTED):
Global using statements
File-scoped namespaces
Record structs
Required members
Use Instead (C# 7.3 Compatible):
Traditional using statements with braces
Switch statements instead of switch expressions
Explicit null checks instead of null-coalescing assignment
Array slicing with manual indexing
Abstract classes or interfaces instead of default interface methods
Environment Considerations (Windows environment)
Use Windows-style paths with backslashes (e.g., C:\path\to\file.cs)
Use Windows-appropriate commands when suggesting terminal operations
Consider Windows-specific behaviors when working with file system operations
Common .NET Framework Pitfalls and Best Practices
Async/Await Patterns
ConfigureAwait(false): Always use ConfigureAwait(false) in library code to avoid deadlocks:
var result = await SomeAsyncMethod().ConfigureAwait(false);
Avoid sync-over-async: Don't use .Result or .Wait() or .GetAwaiter().GetResult(). These sync-over-async patterns can lead to deadlocks and poor performance. Always use await for asynchronous calls.
DateTime Handling
Use DateTimeOffset for timestamps: Prefer DateTimeOffset over DateTime for absolute time points
Specify DateTimeKind: When using DateTime, always specify DateTimeKind.Utc or DateTimeKind.Local
Culture-aware formatting: Use CultureInfo.InvariantCulture for serialization/parsing
String Operations
StringBuilder for concatenation: Use StringBuilder for multiple string concatenations
StringComparison: Always specify StringComparison for string operations:
Dispose pattern: Implement IDisposable properly for unmanaged resources
Using statements: Always wrap IDisposable objects in using statements
Avoid large object heap: Keep objects under 85KB to avoid LOH allocation
Configuration
Use ConfigurationManager: Access app settings through ConfigurationManager.AppSettings
Connection strings: Store in <connectionStrings> section, not <appSettings>
Transformations: Use web.config/app.config transformations for environment-specific settings
Exception Handling
Specific exceptions: Catch specific exception types, not generic Exception
Don't swallow exceptions: Always log or re-throw exceptions appropriately
Use using for disposable resources: Ensures proper cleanup even when exceptions occur
Performance Considerations
Avoid boxing: Be aware of boxing/unboxing with value types and generics
String interning: Use string.Intern() judiciously for frequently used strings
Lazy initialization: Use Lazy<T> for expensive object creation
Avoid reflection in hot paths: Cache MethodInfo, PropertyInfo objects when possible
1---2name: dotnet-framework3description: .NET Framework Development4---5# .NET Framework Development67## Build and Compilation Requirements8- Always use `msbuild /t:rebuild` to build the solution or projects instead of `dotnet build`910## Project File Management1112### Non-SDK Style Project Structure13.NET Framework projects use the legacy project format, which differs significantly from modern SDK-style projects:1415- **Explicit File Inclusion**: All new source files **MUST** be explicitly added to the project file (`.csproj`) using a `<Compile>` element16 - .NET Framework projects do not automatically include files in the directory like SDK-style projects17 - Example: `<Compile Include="Path\To\NewFile.cs" />`1819- **No Implicit Imports**: Unlike SDK-style projects, .NET Framework projects do not automatically import common namespaces or assemblies2021- **Build Configuration**: Contains explicit `<PropertyGroup>` sections for Debug/Release configurations2223- **Output Paths**: Explicit `<OutputPath>` and `<IntermediateOutputPath>` definitions2425- **Target Framework**: Uses `<TargetFrameworkVersion>` instead of `<TargetFramework>`26 - Example: `<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>`2728## NuGet Package Management29- Installing and updating NuGet packages in .NET Framework projects is a complex task requiring coordinated changes to multiple files. Therefore, **do not attempt to install or update NuGet packages** in this project.30- Instead, if changes to NuGet references are required, ask the user to install or update NuGet packages using the Visual Studio NuGet Package Manager or Visual Studio package manager console.31- When recommending NuGet packages, ensure they are compatible with .NET Framework or .NET Standard 2.0 (not only .NET Core or .NET 5+).3233## C# Language Version is 7.334- This project is limited to C# 7.3 features only. Please avoid using:3536### C# 8.0+ Features (NOT SUPPORTED):37 - Using declarations (`using var stream = ...`)38 - Await using statements (`await using var resource = ...`)39 - Switch expressions (`variable switch { ... }`)40 - Null-coalescing assignment (`??=`)41 - Range and index operators (`array[1..^1]`, `array[^1]`)42 - Default interface methods43 - Readonly members in structs44 - Static local functions45 - Nullable reference types (`string?`, `#nullable enable`)4647### C# 9.0+ Features (NOT SUPPORTED):48 - Records (`public record Person(string Name)`)49 - Init-only properties (`{ get; init; }`)50 - Top-level programs (program without Main method)51 - Pattern matching enhancements52 - Target-typed new expressions (`List<string> list = new()`)5354### C# 10+ Features (NOT SUPPORTED):55 - Global using statements56 - File-scoped namespaces57 - Record structs58 - Required members5960### Use Instead (C# 7.3 Compatible):61 - Traditional using statements with braces62 - Switch statements instead of switch expressions63 - Explicit null checks instead of null-coalescing assignment64 - Array slicing with manual indexing65 - Abstract classes or interfaces instead of default interface methods6667## Environment Considerations (Windows environment)68- Use Windows-style paths with backslashes (e.g., `C:\path\to\file.cs`)69- Use Windows-appropriate commands when suggesting terminal operations70- Consider Windows-specific behaviors when working with file system operations7172## Common .NET Framework Pitfalls and Best Practices7374### Async/Await Patterns75- **ConfigureAwait(false)**: Always use `ConfigureAwait(false)` in library code to avoid deadlocks:76 ```csharp77 var result = await SomeAsyncMethod().ConfigureAwait(false);78 ```79- **Avoid sync-over-async**: Don't use `.Result` or `.Wait()` or `.GetAwaiter().GetResult()`. These sync-over-async patterns can lead to deadlocks and poor performance. Always use `await` for asynchronous calls.8081### DateTime Handling82- **Use DateTimeOffset for timestamps**: Prefer `DateTimeOffset` over `DateTime` for absolute time points83- **Specify DateTimeKind**: When using `DateTime`, always specify `DateTimeKind.Utc` or `DateTimeKind.Local`84- **Culture-aware formatting**: Use `CultureInfo.InvariantCulture` for serialization/parsing8586### String Operations87- **StringBuilder for concatenation**: Use `StringBuilder` for multiple string concatenations88- **StringComparison**: Always specify `StringComparison` for string operations:89 ```csharp90 string.Equals(other, StringComparison.OrdinalIgnoreCase)91 ```9293### Memory Management94- **Dispose pattern**: Implement `IDisposable` properly for unmanaged resources95- **Using statements**: Always wrap `IDisposable` objects in using statements96- **Avoid large object heap**: Keep objects under 85KB to avoid LOH allocation9798### Configuration99- **Use ConfigurationManager**: Access app settings through `ConfigurationManager.AppSettings`100- **Connection strings**: Store in `<connectionStrings>` section, not `<appSettings>`101- **Transformations**: Use web.config/app.config transformations for environment-specific settings102103### Exception Handling104- **Specific exceptions**: Catch specific exception types, not generic `Exception`105- **Don't swallow exceptions**: Always log or re-throw exceptions appropriately106- **Use using for disposable resources**: Ensures proper cleanup even when exceptions occur107108### Performance Considerations109- **Avoid boxing**: Be aware of boxing/unboxing with value types and generics110- **String interning**: Use `string.Intern()` judiciously for frequently used strings111- **Lazy initialization**: Use `Lazy<T>` for expensive object creation112- **Avoid reflection in hot paths**: Cache `MethodInfo`, `PropertyInfo` objects when possible
Run npx skillmds@latest add diegosouzapw/dotnet-framework in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
.NET Framework Development It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
diegosouzapw (@diegosouzapw) published this skill. Their other Agent Skills are listed on their SkillMD profile.