How to chage default website icon in visual studio?

Viewed 819

I need to change this icon:

enter image description here

I already changed the icon in the properties of the project, and proceeded to build the project:

enter image description here

But the icon doesn't change. Is there anything else I need to do?

1 Answers

But the icon doesn't change. Is there anything else I need to do?

If you want to set the icon in properties.Be sure there is only one .ico file named favicon in your project,then build the project.You need press both Ctrl+F5 in the browser to refresh the website.

Another way is:

My .ico file located in the wwwroot folder,so I just add the following code to the _Layout.cshtml:

<head>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/site.css" />

    //add this line..
    <link rel="icon" type="image/png" href="~/YourIconName.ico" sizes="32x32">
</head>
Related