[英]How to connect CSS file to ASP.NET Core's _Layout.cshtml?
@using Microsoft.AspNetCore.Hosting
@using Microsoft.AspNetCore.Mvc.ViewEngines
@inject IWebHostEnvironment Environment
@inject ICompositeViewEngine Engine
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - MerchShop</title>
<environment include="Development">
<link rel="stylesheet" href="~/Identity/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/Identity/css/site.css" />
</environment>
</head>
This is the _Layout.cshtml
from ASP.NET Core 6.0 with react + individual accounts and I'm trying to change styles for identity pages, which uses this layout.这是
_Layout.cshtml
Core 6.0 中的 _Layout.cshtml,带有 react + 个人帐户,我正在尝试将 styles 更改为使用此布局的身份页面。
All the pages in Areas/Identity/Pages/Account
and Pages/Shared/
and wwwroot/
I created with add new scaffoled item > identity (if you will try to generate them and you will get an error, add this NuGet package Microsoft.Microsoft.VisualStudio.Web.CodeGeneration.Core
and update all the others).我使用添加新脚手架项目 > 身份创建的
Areas/Identity/Pages/Account
和Pages/Shared/
和wwwroot/
中的所有页面(如果您尝试生成它们并且会收到错误,请添加此 NuGet package Microsoft.Microsoft.VisualStudio.Web.CodeGeneration.Core
并更新所有其他)。
So technically I didn't write a single line of code except update-database
in package manager console in the beginning and still site.css
changes nothing, so I don't know what to do.所以从技术上讲,我没有写任何代码,除了
update-database
在 package 管理器控制台的开头和仍然是site.css
没有改变,所以我不知道该怎么做。
BUT if I will remove a link to bootstrap.css
, bootstrap will disappear from the page, so this link works - BUT if I will go to that file and remove all lines of code in it, it will still work just like before.但是,如果我要删除指向
bootstrap.css
8CBA22E28EB17B5F5C6AE2A266AZ 的链接,则引导程序将从页面中消失,因此此链接有效-但如果我将 go 指向该文件并删除其中的所有代码行,它仍然可以像以前一样工作。 I don't know what to do please help.我不知道该怎么办请帮忙。
nvm i just had to create Identity/css
folder in wwwroot... nvm 我只需要在 wwwroot 中创建
Identity/css
文件夹...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.