RapidArchitecture 0.1.0

dotnet add package RapidArchitecture --version 0.1.0
                    
NuGet\Install-Package RapidArchitecture -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RapidArchitecture" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RapidArchitecture" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="RapidArchitecture" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RapidArchitecture --version 0.1.0
                    
#r "nuget: RapidArchitecture, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RapidArchitecture@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RapidArchitecture&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=RapidArchitecture&version=0.1.0
                    
Install as a Cake Tool

RapidArchitecture - Fluent Architecture Rules for Roslyn

This package enables developers to create fluent rules for their architecture, leveraging Roslyn to generate errors, warnings, and other diagnostics. It allows you to define custom architecture rules in a clean and fluent syntax, providing feedback directly within your development environment.

Installation

Make sure to create a new project that will store your Analyzer rules. This project can look like this:

<Project Sdk="Microsoft.NET.Sdk">
    
    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <IsPackable>false</IsPackable>
        <Nullable>enable</Nullable>
        <LangVersion>latest</LangVersion>

        <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
        <IsRoslynComponent>true</IsRoslynComponent>

        <RootNamespace>**REPLACE WITH YOUR ASSEMBLY NAME**</RootNamespace>
        <AssemblyName>**REPLACE WITH YOUR ASSEMBLY NAME**</AssemblyName>
    </PropertyGroup>
    
</Project>

You can install this package via NuGet:

dotnet add package RapidArchitecture

Next you can reference your newly created Analyzer project from the projects that you want to analyze. Add the following configuration to your project reference:

    <ItemGroup>
        <ProjectReference Include="**PATH TO PROJECT**" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
    </ItemGroup>

Usage

Once installed, you can create your own architecture rules using a fluent API. You can create new rules from within an analyzer class. Here is an example of a simple rule that checks if a type name contains a specific string:

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using RapidArchitecture.Analyzers.Architecture;
using RapidArchitecture.Analyzers.Builders.Extensions;

namespace Rapidata.Analyzers.Rules;

[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class ArchitectureRules : ArchitectureAnalyzer
{
    public ArchitectureRules()
    {
        RuleFor(Types().ImplementingInterface("IMessage"))
            .Must()
            .HaveNameMatching(x => x.EndsWith("Message"))
            .WithMessage("Type name must end with 'Message'");
        
        RuleFor(Types().ImplementingInterface("IEvent"))
            .Must()
            .HaveNameMatching(x => x.EndsWith("Event"))
            .WithMessage("Type name must end with 'Event'");
    }
}

Contributing

If you'd like to contribute, please feel free to submit a pull request. We welcome any improvements or suggestions.

License

This package is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 189 3/28/2025
0.0.2 183 3/27/2025
0.0.1 183 3/27/2025