nx-dotnet Documentation

website·Indexed 32 days ago

https://www.nx-dotnet.com/

Documentation for nx-dotnet, providing generators and executors to integrate .NET projects into an Nx workspace. Features include support for application and library generation, NuGet and project references, Swagger/OpenAPI code generation, and executors for build, test, serve, and publish operations via the dotnet CLI. Note: @nx-dotnet/core is deprecated; users are advised to migrate to @nx/dotnet.

Tokens
9.1K
Snippets
26
Records
87
Agent score
62%

What's inside nx-dotnet

  1. Run tests using @nx-dotnet/core:test

    The @nx-dotnet/core:test executor runs .NET tests using the dotnet CLI. It allows developers to configure test execution, filtering, and diagnostic collection through a set of options in the Nx project configuration.
  2. Generate TypeScript code from OpenAPI specifications using @nx-dotnet/core:swagger-typescript

    The @nx-dotnet/core:swagger-typescript generator allows developers to automatically generate TypeScript code based on an OpenAPI or Swagger specification file. This ensures type safety and synchronization between a .NET backend and a TypeScript frontend.
    npx nx g @nx-dotnet/core:swagger-typescript --openapiJsonPath=path/to/swagger.json --outputProject=my-frontend-app
  3. Run a .NET application using @nx-dotnet/core:serve

    The @nx-dotnet/core:serve executor uses dotnet watch to run a .NET application. It allows for hot-reloading by watching files for changes by default.
  4. Extract OpenAPI Swagger documentation using @nx-dotnet/core:update-swagger

    The @nx-dotnet/core:update-swagger executor extracts OpenAPI Swagger documentation from a .NET Web API. It allows developers to automate the generation of swagger files by specifying the output location and the target startup assembly.
  5. Add a Swagger extraction target to a .NET WebAPI project

    Use the @nx-dotnet/core:add-swagger-target generator to add a target to a WebAPI-based project. This target extracts the swagger.json file into a newly generated library project. You can optionally create an additional project dedicated to code generation based on the extracted swagger specification.
    npx nx g @nx-dotnet/core:add-swagger-target --project=<project-name>
  6. Manage .NET local tools and manifests

    nx-dotnet includes capabilities to install local .NET tools and automatically create tool manifests during the initialization process.
  7. Format and lint .NET projects using @nx-dotnet/core:format

    The @nx-dotnet/core:format executor uses the dotnet-format tool to format and lint a project. By default, it runs in check mode (check: true), meaning it will validate formatting and return a non-zero exit code if changes are needed, but will not save those changes to disk.
  8. Generate code from OpenAPI specs using @nx-dotnet/core:openapi-codegen

    The openapi-codegen executor automates the process of updating a codegen-based library by invoking nx g @nx-dotnet/core:swagger-typescript with the specified parameters. It allows developers to define the source OpenAPI JSON path and the target project for the generated code.
  9. Nx version requirement for dep-graph plugin

    Starting from version 1.0.0, the minimum required Nx version is 12.6 if you are using the dep-graph plugin.
  10. Build a .NET application using @nx-dotnet/core:build

    The @nx-dotnet/core:build executor builds a .NET application by invoking the dotnet CLI build command. It allows configuration of build settings, output directories, and framework targets through the Nx project configuration.
  11. Implement the Single Version Principle in .NET

    nx-dotnet provides support for the Single Version Principle, helping maintain consistent dependency versions across a monorepo.