> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# NewCommand

> Creates a new EasyAF solution: the Core, Data, Business, Api, MessageBus, and Tests projects, referenced the way EasyAF expects, with the solution-level buil...

## Definition

**Assembly:** CloudNimble.EasyAF.Tools.dll

**Namespace:** CloudNimble.EasyAF.Tools.Commands

**Inheritance:** CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand

## Syntax

```csharp theme={"dark"}
CloudNimble.EasyAF.Tools.Commands.NewCommand
```

## Summary

Creates a new EasyAF solution: the Core, Data, Business, Api, MessageBus, and Tests projects, referenced the way EasyAF expects,
with the solution-level build files and an `.slnx`.

## Remarks

Projects are created in-process from the SDK's own `classlib`, `web`, and `console` templates, then configured with
EasyAF project types, package references, and project references. EasyAF files (Program.cs, appsettings, test bases) are written over
the template output.

`new` only creates and links projects. It doesn't connect a database, restore, build, or start any process; `dotnet easyaf init`
connects a database afterwards.

## Constructors

### &#x20;.ctor

#### Syntax

```csharp theme={"dark"}
public NewCommand()
```

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

#### Syntax

```csharp theme={"dark"}
protected EasyAFBaseCommand()
```

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public Object()
```

## Properties

### &#x20;Framework

Gets or sets the target framework: `net10.0` (the default) or `net11.0`.

#### Syntax

```csharp theme={"dark"}
public string Framework { get; set; }
```

#### Property Value

Type: `string`

### &#x20;Name

Gets or sets the solution name. It is also the root namespace unless [NewCommand.Namespace](/api-reference/CloudNimble/EasyAF/Tools/Commands/NewCommand.md#namespace) is set.

#### Syntax

```csharp theme={"dark"}
public string Name { get; set; }
```

#### Property Value

Type: `string`

### &#x20;Namespace

Gets or sets the root namespace for the projects. Defaults to [NewCommand.Name](/api-reference/CloudNimble/EasyAF/Tools/Commands/NewCommand.md#name).

#### Syntax

```csharp theme={"dark"}
public string Namespace { get; set; }
```

#### Property Value

Type: `string`

### &#x20;NoApi

Gets or sets whether to leave out the Api project and its tests.

#### Syntax

```csharp theme={"dark"}
public bool NoApi { get; set; }
```

#### Property Value

Type: `bool`

### &#x20;NoMessageBus

Gets or sets whether to leave out the MessageBus.Core, MessageBus.Dispatch, and MessageBus.Runtime projects.

#### Syntax

```csharp theme={"dark"}
public bool NoMessageBus { get; set; }
```

#### Property Value

Type: `bool`

### &#x20;NoRuntime

Gets or sets whether to leave out only the MessageBus.Runtime project.

#### Syntax

```csharp theme={"dark"}
public bool NoRuntime { get; set; }
```

#### Property Value

Type: `bool`

### &#x20;OutputDirectory

Gets or sets the folder to create the solution in. Defaults to `./{Name}`.

#### Syntax

```csharp theme={"dark"}
public string OutputDirectory { get; set; }
```

#### Property Value

Type: `string`

### &#x20;WebJob

Gets or sets whether to add Azure WebJob publish settings to the MessageBus.Runtime project.

#### Syntax

```csharp theme={"dark"}
public bool WebJob { get; set; }
```

#### Property Value

Type: `bool`

## Methods

### &#x20;CheckMSBuildRegistered Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Ensures MSBuild is registered with the latest available version.

#### Syntax

```csharp theme={"dark"}
protected static void CheckMSBuildRegistered()
```

### &#x20;ConfigureDirectoryBuildProps Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Configures Directory.Build.props with EasyAF namespace, UserSecretsId, and analyzer references using MSBuildProjectManager.

#### Syntax

```csharp theme={"dark"}
protected static void ConfigureDirectoryBuildProps(string commonNamespace, string userSecretsId, string[] projectFiles)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `commonNamespace` | `string` | The common namespace to set. |
| `userSecretsId` | `string` | The UserSecretsId to set. |
| `projectFiles` | `string[]` | Array of project file paths. |

### &#x20;ConfigureProjectTypes Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Discovers and configures project types and namespace for all projects in the current directory and subdirectories.

#### Syntax

```csharp theme={"dark"}
protected static void ConfigureProjectTypes(string userSecretsId)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `userSecretsId` | `string` | The UserSecretsId to set in Directory.Build.props. |

### &#x20;DetectCommonNamespace Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Detects the common namespace from existing projects.

#### Syntax

```csharp theme={"dark"}
protected static string DetectCommonNamespace(string[] projectFiles)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `projectFiles` | `string[]` | Array of project file paths. |

#### Returns

Type: `string`
The detected common namespace, or null if none found.

### &#x20;DetermineProjectType Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Determines the EasyAFProjectType based on the project file name and content.

#### Syntax

```csharp theme={"dark"}
protected static string DetermineProjectType(string projectFilePath)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `projectFilePath` | `string` | The path to the project file. |

#### Returns

Type: `string`
The determined project type, or null if no supported type is detected.

### &#x20;Equals Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual bool Equals(object obj)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `obj` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;Equals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;ExtractUserSecretsId Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Extracts the UserSecretsId from a project file using MSBuild evaluation.
This will properly evaluate the project with all imports including Directory.Build.props.

#### Syntax

```csharp theme={"dark"}
protected static string ExtractUserSecretsId(string projectFilePath)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `projectFilePath` | `string` | The path to the project file. |

#### Returns

Type: `string`
The UserSecretsId if found, otherwise null.

### &#x20;ExtractUserSecretsIdFromDataProject Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Extracts the UserSecretsId from the data project folder.

#### Syntax

```csharp theme={"dark"}
protected static string ExtractUserSecretsIdFromDataProject(string dataFolder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `dataFolder` | `string` | The data project folder path. |

#### Returns

Type: `string`
The UserSecretsId if found, otherwise null.

### &#x20;ExtractUserSecretsIdFromDirectoryBuildProps Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Extracts the UserSecretsId from Directory.Build.props in the current directory.

#### Syntax

```csharp theme={"dark"}
protected static string ExtractUserSecretsIdFromDirectoryBuildProps()
```

#### Returns

Type: `string`
The UserSecretsId if found, otherwise null.

### &#x20;FindCommonPrefix Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Finds the common prefix among a list of strings.

#### Syntax

```csharp theme={"dark"}
protected static string FindCommonPrefix(System.Collections.Generic.List<string> strings)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `strings` | `System.Collections.Generic.List<string>` | The list of strings to find common prefix for. |

#### Returns

Type: `string`
The common prefix.

### &#x20;GetHashCode Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### &#x20;GetType Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### &#x20;MemberwiseClone Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### &#x20;OnExecuteAsync

Creates the solution.

#### Syntax

```csharp theme={"dark"}
public System.Threading.Tasks.Task<int> OnExecuteAsync(System.Threading.CancellationToken cancellationToken = null)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `cancellationToken` | `System.Threading.CancellationToken` | A token to cancel the operation. |

#### Returns

Type: `System.Threading.Tasks.Task<int>`
0 when the solution was created; otherwise 1.

### &#x20;ReferenceEquals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;SetProjectType Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Adds or updates the EasyAFProjectType property in a project file using MSBuildProjectManager.

#### Syntax

```csharp theme={"dark"}
protected static void SetProjectType(string projectFilePath, string projectType)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `projectFilePath` | `string` | The path to the project file. |
| `projectType` | `string` | The project type to set. |

### &#x20;SetUserSecretAsync Inherited

> [!NOTE]
>
> Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`

Sets a user secret value using the official dotnet user-secrets CLI tool.

#### Syntax

```csharp theme={"dark"}
protected static System.Threading.Tasks.Task SetUserSecretAsync(string userSecretsId, string key, string value, string projectPath)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `userSecretsId` | `string` | The user secrets ID. |
| `key` | `string` | The secret key. |
| `value` | `string` | The secret value. |
| `projectPath` | `string` | The project directory path. |

#### Returns

Type: `System.Threading.Tasks.Task`

### &#x20;ToString Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual string ToString()
```

#### Returns

Type: `string?`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.