Hi @AnonymousKKYY ,
Based on your image, I think the root cause was that the project was incorrectly set up as a Class Library, rather than a Console Application or Web Application, which is required for ASP.NET Core apps to run properly.
When you set the Output Type to Class Library, you're telling Visual Studio to build a DLL, not an executable. This has several implications:
- Class Libraries cannot be executed directly—they are meant to be referenced by other projects.
- ASP.NET Core applications require an entry point (like Program.cs with a Main method) to start the web server.
- The RunCommand property is used by Visual Studio and IIS Express to determine how to launch the application. Since Class Libraries don’t have a RunCommand, the system throws an error.
To resolve the issue:
- Change the Output Type to Console Application:
In Solution Explorer, right-click on the project name > Properties > Application tab.
Set Output type to Console Application.
- Ensure the correct SDK is used in your .csproj file:
In Solution Explorer, right-click on the project name > Select "Edit Project File". > This opens the .csproj file directly in the editor.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
Hope my solution would solve your issue.