DEV Community

Ali SAFARI
Ali SAFARI

Posted on

Introducing NxDotnet

NxDotnet

Adding .NET to Nx workspace

🔎 Nx is a set of Extensible Dev Tools for Monorepos and NxDotnet is one of the many plugins of Nx, which add capabilities for developing dotnet applications such as generating applications, libraries, etc as well as the devtools to test, and build projects as well.

Installing NxDotNet

After creating an Nx workspace (How to set up an Nx workspace? Click here!), open a command line interface (CLI) like Windows PowerShell inside your existing workspace and run the command below to add .Net capabilities to your workspace.

yarn add @nx-dotnet/core
Enter fullscreen mode Exit fullscreen mode

Generate an application

To generate an application run:

nx g @nx-dotnet/core:app my-app
Enter fullscreen mode Exit fullscreen mode

Generate a library

To generate a library run:

nx g @nx-dotnet/core:lib my-lib
Enter fullscreen mode Exit fullscreen mode

Serve generated application locally

For a dev server, run the command below. This command can automatically reload if any of source file changes by watching for file changes and rebuilding the project.

nx serve my-app
Enter fullscreen mode Exit fullscreen mode

Build the project

To build the project run:

nx build my-app
Enter fullscreen mode Exit fullscreen mode

and for a production build, run:

nx build my-app --prod
Enter fullscreen mode Exit fullscreen mode

Dependency diagram

In order to see dependency diagaram of your application(s) and lib(s), run the command below:

nx dep-graph
Enter fullscreen mode Exit fullscreen mode

Top comments (0)