Using ASP.Net Boilerplate (.net 8), whats the correct way to run the project using CLI on Linux.
When listing the projects I get the following:
▶ dotnet sln list
Project(s)
----------
src/SimpleTaskSsytem.Application/SimpleTaskSsytem.Application.csproj
src/SimpleTaskSsytem.Core/SimpleTaskSsytem.Core.csproj
src/SimpleTaskSsytem.EntityFrameworkCore/SimpleTaskSsytem.EntityFrameworkCore.csproj
src/SimpleTaskSsytem.Migrator/SimpleTaskSsytem.Migrator.csproj
src/SimpleTaskSsytem.Web.Core/SimpleTaskSsytem.Web.Core.csproj
src/SimpleTaskSsytem.Web.Host/SimpleTaskSsytem.Web.Host.csproj
test/SimpleTaskSsytem.Tests/SimpleTaskSsytem.Tests.csproj
When trying to dotnet run
one of these projects I get the following:
▶ dotnet run --project src/SimpleTaskSsytem.Core/SimpleTaskSsytem.Core.csproj
Unable to run your project.
Ensure you have a runnable project type and ensure 'dotnet run' supports this project.
A runnable project should target a runnable TFM (for instance, net5.0) and have OutputType 'Exe'.
The current OutputType is 'Library'.
The documentation says Visual Studio is a per-requisite to running the project, but can it be done using the CLI? and if so what is the correct way?
2
Answers
From you project name
SimpleTaskSsytem.Core.csproj
I guess it is a core class library.Such project is not runnable – no matter if from Visual Studio or via
dotnet
CLI.If you would create console app, it would be all ok:
And below would return an error that you are seeing:
The error you encountered says that the project you’re trying to run has a ‘Library’ OutputType (it’s a class library project). you need to make sure you’re targeting the correct project that contains the entry point for your application. A class library project doesn’t have an entry point.
From the list of projects you wrote, it looks like SimpleTaskSsytem.Web.Host is the web project that contains the main entry point (i.e., the Program.cs file and Startup.cs file) and can be run using dotnet run.