[英]ASP.NET CORE web application doesn't use .css styles when run using dotnet command
I have a ASP .NET CORE application, targeted in verion 6.0.我有一个 ASP .NET 核心应用程序,针对版本 6.0。 When I run it from Visual Studio it looks great, but when I run it using
do.net
command:当我从 Visual Studio 运行它时它看起来很棒,但是当我使用
do.net
命令运行它时:
dotnet webApplication1.dll
it looks like no.css styles or.js scripts where found and used.它看起来像 no.css styles 或 .js 脚本在哪里被发现和使用。 I searched this documentation but cannot find the hint how to include styles path.
我搜索了此文档,但找不到如何包含 styles 路径的提示。
I think you are using the wrong command You should use.我认为你使用了错误的命令你应该使用。
dotnet run
If you want to use the do.net command you should publish you app before in order to have all the misc files.如果您想使用 do.net 命令,您应该先发布您的应用程序,以便拥有所有 misc 文件。
You need to do:你需要做:
dotnet publish
Before running the app using在使用运行应用程序之前
dotnet Webapp.dll
I solved it by manually copying wwwroot
folder to the \bin\Debug\net6.0
directory.我通过手动将
wwwroot
文件夹复制到\bin\Debug\net6.0
目录来解决它。 For some reasons it is not being copied there automatically.由于某些原因,它不会自动复制到那里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.