简体   繁体   English

ASP.NET 核心 web 应用程序不使用。css styles 使用 do.net 命令运行时

[英]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.

相关问题 无法在 asp.net Core 3.0 web 应用程序中访问命令 dotnet ef - Can't access command dotnet ef in asp.net Core 3.0 web app 如何运行已发布的 Asp.Net 核心 Web 应用程序 - How to run the published Asp.Net core web application with 针对完整dotnet框架的ASP.NET Core Web应用程序是否可以在IIS中运行? - Does ASP.NET Core web application targeting full dotnet framework work in IIS? 单击时,asp.net c#命令按钮不运行命令代码 - asp.net c# Command button doesn't run command code when clicked 如何在不使用 Visual Studio 的情况下直接在 Dockers 容器上运行 ASP.NET Core Web 应用程序 - How to run an ASP.NET Core Web Application on Dockers container directly without using Visual Studio Asp.net 核心 web API 6 没有收到 IFormFile - Asp.net core web API 6 Doesn't receive IFormFile ASP.NET Core App无法在Localhost上运行 - ASP.NET Core App Doesn't Run On Localhost 在CSS的ASP.NET中使用管理样式 - Using the Manage Styles in ASP.NET for CSS ASP.NET Core应用程序在IIS Express中不起作用 - ASP.NET Core application doesn't work in IIS Express 是否可以使用 dotnet new 创建一个 ASP.NET Web Application Empty .Net Framework 4.7.2 项目? - Is it possible to use dotnet new to create an ASP.NET Web Application Empty .Net Framework 4.7.2 project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM