ASP.NET CORE web application doesn't use .css styles when run using dotnet command

1.2k views Asked by At

I have a ASP .NET CORE application, targeted in verion 6.0. When I run it from Visual Studio it looks great, but when I run it using dotnet command:

dotnet webApplication1.dll

it looks like no .css styles or .js scripts where found and used. I searched this documentation but cannot find the hint how to include styles path.

2

There are 2 answers

0
user3057544 On

I solved it by manually copying wwwroot folder to the \bin\Debug\net6.0 directory. For some reasons it is not being copied there automatically.

0
khalid bourzayq On

I think you are using the wrong command You should use.

dotnet run

If you want to use the dotnet command you should publish you app before in order to have all the misc files.

You need to do :

dotnet publish

Before running the app using

dotnet Webapp.dll