dotnet / dotnet/sdk

dotnet new record has no switch for "just" record

Open
#55,064 1 comment 0 reactions 0 assignees View on GitHub
untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Description

Apologies if it's more of a feature request than an issue.
I tried using `dot net new record` and it created a `record class` with `public record class ` instead of `public record` and I could not find a switch for "just" `public record` there to match other `record` items in my project.
I am aware we can have custom templates, but a `--short` to shorthand would've been nice.
Thanks.

### Reproduction Steps

Follow these steps, I used PowerShell 7.6 for this:

```powershell
dotnet new update
cd /
mkdir record-test
cd .\record-test\
dotnet new classlib -n MyClassLib
cd .\MyClassLib\
dotnet new record -n MyAwesomeRecord
cat .\MyAwesomeRecord.cs

```

### Expected behavior

Output should have been:

```csharp
namespace MyClassLib;

public record MyAwesomeRecord
{

}
```

### Actual behavior

Output will be:

```csharp
namespace MyClassLib;

public record class MyAwesomeRecord
{

}
```

### Regression?

Not a regression, just missing a switch IMHO.
Thanks.

### Known Workarounds

A custom template?

### Configuration

```powershell
dotnet --info
.NET SDK:
Version: 10.0.301
Commit: 96856fd726
Workload version: 10.0.300-manifests.8c7d7c03
MSBuild version: 18.6.4+96856fd72

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.301\
```

### Other information

Please change to feature request / new feature etc. if not an issue.
Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with the documented `dotnet new record -n MyAwesomeRecord` command and compare its output with the requested `public record` form. Trace the `dotnet new record` template entry point and determine how a switch such as `--short` should affect generated output; done means the switch produces the requested form without changing the existing default.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.