© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2mo ago•
32 replies
رجل أسود

A const field requires a value to be provided

beginner
MSBuild version 17.9.4+90725d08d for .NET
  Determining projects to restore...
  Restored /home/codegrade/student/Files/Files.csproj (in 146 ms).
/home/codegrade/student/Files/Knight.cs(6,26): error CS0145: A const field requires a value to be provided [/home/codegrade/student/Files/Files.csproj]

Build FAILED.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.62
MSBuild version 17.9.4+90725d08d for .NET
  Determining projects to restore...
  Restored /home/codegrade/student/Files/Files.csproj (in 146 ms).
/home/codegrade/student/Files/Knight.cs(6,26): error CS0145: A const field requires a value to be provided [/home/codegrade/student/Files/Files.csproj]

Build FAILED.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.62
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to understand pining static field, const and instance field
C#CC# / help
2y ago
Scaffolding Error - Requires a primary key to be defined
C#CC# / help
4y ago
"Non-nullable field..." warning even though the value is ensured to be declared
C#CC# / help
2y ago
✅ List<KeyValuePair<Trader, long>> requires primary key to be defined
C#CC# / help
2y ago