设置ASP.NET Core 2.0图标 [英] Setting ASP.NET Core 2.0 favicon

查看:289
本文介绍了设置ASP.NET Core 2.0图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加和设置favicon.ico.

I'm trying to add and set favicon.ico.

当我看到Visual Studio 2017自动创建的初始项目时,favicon.ico文件仅在wwwroot目录中,并且没有设置.

When I saw a initial project that Visual Studio 2017 make automatically, the favicon.ico file is just in the wwwroot directory and there is no setting for it.

因此,我将favicon文件添加到wwwroot目录中. 但是该收藏夹图标不会显示在任何浏览器中.

So, I add favicon file into wwwroot directory. But the favicon does not show up in any browsers.

如何在ASP.NET Core 2.0中设置收藏夹图标?

How can I set the favicon in ASP.NET Core 2.0?

推荐答案

wwwroot/index.html文件包含指向收藏夹图标的链接.

wwwroot/index.html file has the link to favicon.

<link rel="icon" type="image/x-icon" href="favicon.ico">

是将网站图标添加到网站的代码.

is the code to add favicon to the website.

对于.net核心单页应用程序(SPA)项目,该图标将从其各自的静态文件中呈现.例如,如果使用angular作为客户端应用程序,则在src内有index.html文件,在index.html中,您可以将收藏夹图标与以下代码链接

For .net core Single Page Application (SPA) project the favicon will be rendered from its own respective static file. For example if are using angular as client application there is index.html file inside src and in index.html you can link your favicon with following code

<link rel="icon" type="image/x-icon" href="favicon.ico">

这篇关于设置ASP.NET Core 2.0图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆