Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ generated_code = true
# XML project files
[*.{slnx,csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,nativeproj,locproj}]
indent_size = 2
max_line_length = 160

# Xml build files
[*.builds]
Expand Down
187 changes: 182 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,187 @@
# NetEvolve.Defaults

This is the NetEvolve.Defaults package, which provides the standard configurations and settings for the NetEvolve projects. Such as `.editorconfig`, build props and targets.
All of our projects are build on top of this package, so we can have a consistent build process and settings across all of our projects.
NetEvolve.Defaults is a comprehensive enterprise-grade build automation and configuration platform that establishes consistent development standards across all NetEvolve projects. It provides unified build properties, standardized configuration files, integrated code analysis, and development guidelines that enforce quality, consistency, and best practices throughout your entire project ecosystem.

## Overview

This repository contains a complete infrastructure for maintaining code quality and consistency across distributed teams and projects. It encompasses:

### Core Components

- **[NetEvolve.Defaults](https://www.nuget.org/packages/NetEvolve.Defaults)**: The foundational build configuration package providing MSBuild properties, targets, and shared settings
- **[NetEvolve.Defaults.Analyzer](https://www.nuget.org/packages/NetEvolve.Defaults.Analyzer)**: A comprehensive Roslyn-based diagnostic analyzer enforcing NuGet package quality standards
- **Build & Configuration Files**: Centralized editor configuration, version management, and continuous integration settings

### Key Features

- **Centralized Build Configuration**: Unified project settings and compilation options for single and multi-targeted projects
- **Code Analysis & Quality Enforcement**: Automated static analysis with Roslyn analyzers and code style enforcement via `.editorconfig`
- **Modern Language Features**: C# 13 language features with nullable reference types, implicit usings, and file-scoped namespaces
- **Continuous Integration Support**: Automatic detection and optimization for CI/CD environments with GitVersion integration
- **NuGet Security Auditing**: Integrated vulnerability scanning for package dependencies via NuGet Audit
- **Semantic Versioning**: Automated semantic versioning powered by GitVersion for consistent version management
- **Package Quality Standards**: Enforced NuGet metadata validation ensuring professional package documentation and discoverability
- **Multi-Framework Support**: Seamless configuration for projects targeting multiple .NET frameworks

## Quick Start

### Installation

Install the core package in your project:

## Installation
To install this package, you can use the following command:
```bash
dotnet add package NetEvolve.Defaults
```
```

For enhanced package quality validation, also add the analyzer:

```bash
dotnet add package NetEvolve.Defaults.Analyzer
```

### Manual Configuration

Add to your project file (`.csproj`, `.fsproj`, or `.vbproj`):

```xml
<ItemGroup>
<PackageReference Include="NetEvolve.Defaults" Version="x.x.x" PrivateAssets="all" />
<PackageReference Include="NetEvolve.Defaults.Analyzer" Version="x.x.x" PrivateAssets="all" />
</ItemGroup>
```

The `PrivateAssets="all"` attribute ensures that these build utilities are only applied to your project and not propagated to consumers of your packages.

## Repository Structure

```
defaults/
├── src/
│ ├── NetEvolve.Defaults/ # Core build configuration package
│ └── NetEvolve.Defaults.Analyzer/ # NuGet package quality analyzer
├── tests/
│ └── NetEvolve.Defaults.Tests.Integration/ # Integration tests
├── docs/
│ └── usage/ # Diagnostic rule documentation
├── decisions/ # Architectural decision records
├── .github/ # GitHub workflows and instructions
├── Directory.Packages.props # Centralized NuGet version management
├── Directory.Build.props # Global MSBuild properties
├── Directory.Build.targets # Global MSBuild targets
└── GitVersion.yml # Semantic versioning configuration
```

## Included Packages

### NetEvolve.Defaults

The foundational package providing standardized build settings:

- **MSBuild Properties & Targets**: Consistent compilation configuration across all projects
- **Editor Configuration**: Standardized code style rules via `.editorconfig`
- **Analyzer Settings**: Pre-configured Roslyn analyzer rules matching enterprise standards
- **NuGet Audit Integration**: Automated security vulnerability scanning
- **Language Configuration**: Modern C# language features with sensible defaults

[Learn more about NetEvolve.Defaults →](https://www.nuget.org/packages/NetEvolve.Defaults)

### NetEvolve.Defaults.Analyzer

Comprehensive diagnostic analyzer for NuGet package quality:

- **Package Metadata Validation**: Ensures complete and professional package information
- **Repository Configuration**: Validates repository URLs, issue trackers, and licensing
- **Build Standards Enforcement**: Verifies compliance with modern build patterns
- **Real-Time Diagnostics**: Immediate feedback during development with actionable fixes
- **9+ Diagnostic Rules**: Covering critical package configuration aspects

[Learn more about NetEvolve.Defaults.Analyzer →](https://www.nuget.org/packages/NetEvolve.Defaults.Analyzer)

## Diagnostic Rules

The analyzer package enforces standardized quality checks via diagnostic rules. For detailed documentation on all rules and remediation steps:

- [NED0001-NED0009 Rules Documentation](https://github.com/dailydevops/defaults/tree/main/docs/usage)
- [Diagnostic Configuration Guide](https://github.com/dailydevops/defaults/tree/main/src/NetEvolve.Defaults.Analyzer#diagnostic-rules)

## Configuration & Customization

All settings can be customized through:

1. **Project File Properties**: Override specific settings in individual `.csproj` files
2. **Directory.Build.props**: Apply settings across all projects in a solution
3. **.editorconfig**: Customize code style and formatting rules
4. **.github/instructions**: Apply project-specific guidelines and conventions

### Common Customizations

**Enable Preview Language Features:**
```xml
<PropertyGroup>
<LangVersion>preview</LangVersion>
</PropertyGroup>
```

**Disable Nullable Reference Types (Not Recommended):**
```xml
<PropertyGroup>
<Nullable>disable</Nullable>
</PropertyGroup>
```

**Customize Target Frameworks:**
```xml
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>
```

## Best Practices

1. **Use PrivateAssets="all"**: Ensures build tools don't leak into package consumers
2. **Enable Nullable Reference Types**: Improves type safety and reduces null reference exceptions
3. **Use Implicit Usings**: Reduces boilerplate and improves code readability
4. **Configure Complete Metadata**: Ensure all NuGet package properties are set for discoverability
5. **Run Analyzers Regularly**: Address diagnostics during development, not at release time
6. **Test Multi-Framework Projects**: Verify code works across all target frameworks

## Architectural Decisions

This project follows architectural principles documented in the [decisions/](https://github.com/dailydevops/defaults/tree/main/decisions) folder. Key decision areas include:

- **Folder Structure & Naming Conventions**: Consistent project organization
- **Centralized Package Management**: Single source of truth for NuGet versions
- **English as Project Language**: All code, documentation, and comments in English
- **.NET 10 & C# 13 Adoption**: Modern language features and runtime support
- **Conventional Commits**: Structured commit messages for automated versioning
- **GitVersion Integration**: Automated semantic versioning from git history

For more details, see [Architectural Decisions](https://github.com/dailydevops/defaults/tree/main/decisions).

## Contributing

Contributions are welcome! When contributing to this project:

1. Follow the existing code style and conventions
2. Ensure all diagnostic analyzers pass without warnings
3. Update relevant documentation
4. Follow [Conventional Commits](https://www.conventionalcommits.org/) format for commit messages
5. Add tests for new functionality

## Support

For issues, feature requests, or questions:

- [GitHub Issues](https://github.com/dailydevops/defaults/issues)
- [GitHub Discussions](https://github.com/dailydevops/defaults/discussions)

## Documentation

- [NetEvolve.Defaults Documentation](https://www.nuget.org/packages/NetEvolve.Defaults)
- [NetEvolve.Defaults.Analyzer Documentation](https://www.nuget.org/packages/NetEvolve.Defaults.Analyzer)
- [Diagnostic Rules Reference](https://github.com/dailydevops/defaults/tree/main/docs/usage)
- [Architectural Decisions](https://github.com/dailydevops/defaults/tree/main/decisions)

## License

This project is licensed under the [MIT License](https://github.com/dailydevops/defaults/blob/main/LICENSE).
78 changes: 66 additions & 12 deletions docs/usage/ned0001.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,74 @@
## Project configuration warning NED0001
# NED0001: Missing Package ID Configuration

The project file is missing or has an incomplete configuration for the `<PackageId />` tag. This tag is crucial as it uniquely identifies the package within the project, ensuring proper management and deployment. Without a valid `<PackageId />`, the build process may fail, leading to potential issues in package restoration and versioning.
## Overview

To resolve this issue, please follow these steps:
**Severity**: Warning
**Category**: Package Metadata
**Applies To**: Packable Projects

- Open the Project File: Locate and open your project file (e.g., `.csproj` for C# projects).
## Description

- Add or Update the `<PackageId />` Tag: Ensure that the `<PackageId />` tag is present and correctly formatted.
The project file is missing or has an incomplete configuration for the `<PackageId />` property. This property uniquely identifies your NuGet package and is essential for proper package management, distribution, and versioning. Without a valid `<PackageId />`, the build process cannot properly create or publish your package.

It should look like this:
```xml
<PackageId>Your.Package.Id</PackageId>
```
## Impact

- Validate the Configuration: After making changes, validate the project file to ensure there are no syntax errors.
- Package creation and publication will fail
- Dependency resolution and version management may be compromised
- Package consumers cannot reference your package reliably
- Package discoverability on NuGet.org is impossible

- Rebuild the Project: Once the configuration is corrected, rebuild your project to confirm that the issue is resolved.
## Resolution

If you continue to experience problems, consider checking the documentation for your specific project type or reaching out to your development team for further assistance. Proper configuration of the `<PackageId />` tag is essential for maintaining a smooth development workflow.
### Step 1: Open Your Project File

Locate and open your project file (`.csproj`, `.fsproj`, or `.vbproj`).

### Step 2: Add or Update the PackageId Property

Ensure the `<PackageId />` property is present in your project's `<PropertyGroup>` section. Use a unique, meaningful identifier following these conventions:

- Use reverse domain notation (e.g., `Company.ProductName.ModuleName`)
- Use PascalCase for segments
- Use periods to separate segments
- Keep it concise but descriptive

```xml
<PropertyGroup>
<PackageId>Your.Company.PackageName</PackageId>
<!-- Additional properties -->
</PropertyGroup>
```

### Step 3: Validate and Rebuild

Validate your project file for syntax errors and rebuild your project:

```bash
dotnet build
```

## Best Practices

- Ensure the `<PackageId />` is unique across the NuGet ecosystem
- Use a consistent naming scheme across related packages
- Consider your package's purpose and domain in the naming
- Avoid generic names that may conflict with existing packages

## Example

```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<PackageId>NetEvolve.Defaults</PackageId>
<PackageVersion>1.0.0</PackageVersion>
<Title>NetEvolve.Defaults</Title>
<Description>Enterprise build configuration and standards package</Description>
</PropertyGroup>
</Project>
```

## See Also

- [NuGet Package Metadata Reference](https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets)
- [Package Naming Conventions](https://docs.microsoft.com/en-us/nuget/concepts/package-naming-conventions)
73 changes: 61 additions & 12 deletions docs/usage/ned0002.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,69 @@
## Project configuration warning NED0002
# NED0002: Missing Package Title Configuration

The project file is missing or has an incomplete configuration for the `<Title />` tag. This tag is essential as it defines the display name of your project, which is used in various contexts, including package management and user interfaces. An incomplete or absent `<Title />` can lead to confusion during deployment and may affect how users perceive your project.
## Overview

To resolve this issue, please follow these steps:
**Severity**: Warning
**Category**: Package Metadata
**Applies To**: Packable Projects

- Open the Project File: Locate and open your project file (e.g., `.csproj` for C# projects).
## Description

- Add or Update the `<Title />` Tag: Ensure that the `<Title />` tag is present and correctly formatted.
The project file is missing or has an incomplete configuration for the `<Title />` property. This property defines the display name of your NuGet package as it appears on NuGet.org and in package management tools. A clear, descriptive title is essential for user discoverability and package recognition.

It should look like this:
```xml
<Title>Your Project Title</Title>
```
## Impact

- Validate the Configuration: After making changes, validate the project file to ensure there are no syntax errors.
- Package displays with a generic or missing name on NuGet.org
- Reduced visibility and discoverability for potential users
- Professional appearance is compromised
- Users cannot quickly understand the package's purpose

- Rebuild the Project: Once the configuration is corrected, rebuild your project to confirm that the issue is resolved.
## Resolution

If you continue to experience problems, consider checking the documentation for your specific project type or reaching out to your development team for further assistance. Proper configuration of the `<Title />` tag is essential for maintaining a smooth development workflow.
### Step 1: Open Your Project File

Locate and open your project file (`.csproj`, `.fsproj`, or `.vbproj`).

### Step 2: Add or Update the Title Property

Ensure the `<Title />` property is present in your project's `<PropertyGroup>` section. Use a human-readable, descriptive title:

```xml
<PropertyGroup>
<Title>Your Package Display Name</Title>
<!-- Additional properties -->
</PropertyGroup>
```

### Step 3: Validate and Rebuild

Validate your project file for syntax errors and rebuild your project:

```bash
dotnet build
```

## Best Practices

- Use a clear, descriptive title that reflects the package's purpose
- Keep the title concise (under 100 characters)
- Use sentence case or PascalCase, consistent with your branding
- Include the key functionality or domain in the title
- Ensure the title is different from and more readable than the `<PackageId />`

## Example

```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<PackageId>NetEvolve.Defaults</PackageId>
<Title>NetEvolve Build Defaults and Configuration</Title>
<Description>Enterprise-grade build configuration and standards package</Description>
</PropertyGroup>
</Project>
```

## See Also

- [NuGet Package Metadata Reference](https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets)
- [Creating Discoverable Packages](https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package)
Loading