Monica.Generators.AutoController 0.1.0-preview.3

This is a prerelease version of Monica.Generators.AutoController.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Monica.Generators.AutoController --version 0.1.0-preview.3
                    
NuGet\Install-Package Monica.Generators.AutoController -Version 0.1.0-preview.3
                    
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="Monica.Generators.AutoController" Version="0.1.0-preview.3">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Monica.Generators.AutoController" Version="0.1.0-preview.3" />
                    
Directory.Packages.props
<PackageReference Include="Monica.Generators.AutoController">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 Monica.Generators.AutoController --version 0.1.0-preview.3
                    
#r "nuget: Monica.Generators.AutoController, 0.1.0-preview.3"
                    
#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 Monica.Generators.AutoController@0.1.0-preview.3
                    
#: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=Monica.Generators.AutoController&version=0.1.0-preview.3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Monica.Generators.AutoController&version=0.1.0-preview.3&prerelease
                    
Install as a Cake Tool

Monica.Generators.AutoController

Monica.Generators.AutoController provides:

  • HTTP API controller generation for Monica handlers
  • build-integrated RPC metadata export / consume
  • generated HTTP and Local RPC client implementations

The authoritative end-user documentation now lives in the Monica.Docs project in this repository.

Primary page:

  • Monica.Docs/docs/zh-CN/scenarios/build-integrated-rpc.md

This README is intentionally brief so package docs do not drift away from the published Monica.Docs content.

FIPS2022/Directory.Build.props and FIPS2022/Directory.Build.targets are examples of this pattern.

This extra setup is only for local source-reference development against the MoLibrary repository.

NuGet Usage

After this package is published to NuGet, the project-level usage stays the same:

  • producer projects still set MonicaRpcMetadataExportDirectory
  • consumer projects still use RpcMetadata by default or override MonicaRpcMetadataConsumeDirectory
  • consumer projects still declare RpcClientConfig
  • shared request/response contracts still belong in the consumer/shared protocol project
  • local modular-monolith hosts still use UseLocalTransport(), while distributed hosts still use UseHttpTransport()

What changes with NuGet is only the infrastructure around the package:

  • you use PackageReference instead of a source ProjectReference
  • you do not need custom Directory.Build.props or Directory.Build.targets glue just to find the build tasks
  • the package already carries the analyzer, build props/targets, and the build task assembly

So the answer is: yes, the workflow is the same after publishing to NuGet, and the setup is actually simpler.

src/
  Services/
    Alarm/
      AlarmService.API/
  Shared/
    Platform.Protocol/
      PublishedLanguages/
      RpcMetadata/

Recommended ownership:

  • API projects own handlers and export metadata.
  • The shared protocol project owns contracts and generated RPC clients.
  • RpcMetadata/*.json is checked into source control next to the consumer project.

Troubleshooting

No metadata file is exported

Check the producer project for all of the following:

  • the generator is referenced
  • AutoControllerConfig is present
  • MonicaRpcMetadataExportDirectory is set
  • the build actually produced __RpcMetadata.g.cs
  • the handler contracts live in shared namespaces that the consumer can reference

No RPC client code is generated

Check the consumer project for all of the following:

  • RpcClientConfig is present
  • the metadata JSON files are under RpcMetadata/ or the configured consume directory
  • the project contains the shared contract types under PublishedLanguages

Rebuild after deleting metadata still fails

Bootstrap requires:

  • producer source projects in the same repository
  • matching export and consume directories
  • readable shared contract source files in the consumer project

If those conditions are not true, restore the checked-in metadata files or build from a repository layout that includes both producers and the consumer project.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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-preview.4 153 4/23/2026
0.1.0-preview.3 58 4/22/2026
0.1.0-preview.2 54 4/21/2026
0.1.0-preview.1 63 1/31/2026

Initial preview release of Monica framework. This is a prerelease version for early testing and feedback.