dotnet / dotnet/sdk

dotnet build raise error on new created project

Open
#54,238 0 comments 0 reactions 0 assignees View on GitHub
Area-Microsoft.CodeAnalysis.NetAnalyzers untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
```
dotnet new console
dotnet build
Restore complete (0.4s)
console failed with 1 error(s) (3.5s)
/home/adavidoaiei/Desktop/console/Program.cs(2,19): error CA1303: Method '' passes a literal string as parameter 'value' of a call to 'void Console.WriteLine(string? value)'. Retrieve the following string(s) from a resource table instead: "Hello, World!". (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1303)

```

### To Reproduce

```
dotnet new console
dotnet build
Restore complete (0.4s)
console failed with 1 error(s) (3.5s)
/home/adavidoaiei/Desktop/console/Program.cs(2,19): error CA1303: Method '' passes a literal string as parameter 'value' of a call to 'void Console.WriteLine(string? value)'. Retrieve the following string(s) from a resource table instead: "Hello, World!". (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1303)

```

### Exceptions (if any)

### Further technical details
details of dotnet --info


.NET SDK:
Version: 9.0.116
Commit: aa545e77b2
Workload version: 9.0.100-manifests.85971e61
MSBuild version: 17.12.57+aa545e77b

Runtime Environment:
OS Name: ubuntu
OS Version: 26.04
OS Platform: Linux
RID: ubuntu.26.04-x64
Base Path: /usr/lib/dotnet/sdk/9.0.116/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
Version: 10.0.7
Architecture: x64
Commit: b16286c228

.NET SDKs installed:
9.0.116 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.15 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.7 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.15 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.7 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
DOTNET_BUNDLE_EXTRACT_BASE_DIR [/home/adavidoaiei/.cache/dotnet_bundle_extract]

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.