Fonts files are not being included when publishing MVC application VS2013
Asked Answered
S

3

8

I have integrated (Twitter)Bootstrap to my ASP.NET MVC (4) application. In my source code I have the following fonts files:

Fonts Files

When I publish my application only the .svg file are being included in this fonts folder.

I have also this img folder being part of bootstrap:

Images

All images files are being included when I publish my application.

So, how can I get VS2013 to copy those fonts files when publishing the application?

Schoolroom answered 13/12, 2013 at 10:6 Comment(1)
Check that the font files are marked "content" for build action when you right-click them to view properties in visual studioLazar
P
4

A temporary solution,

Select your font files and Change Build action as Content from Properties Window. This fixes it in the immediate, but leaves you open to missing files in the future.

To permanently fix this issue this may help,

You can fix this permanently by modifying the default Build Action for font file extensions (.eot, .ttf, etc)

Visual-Studio-default-build-action-for-non-default-file-types

Protohuman answered 13/12, 2013 at 10:34 Comment(0)
S
1

In my case I was deploying to azure and below modification in the web.config fixed my problem.

<configuration>
<system.webServer>
    <staticContent>
        <mimeMap fileExtension="woff" mimeType="application/font-woff" />
        <mimeMap fileExtension="woff2" mimeType="application/font-woff" />
     </staticContent>
</system.webServer>

Refer this link

Spiky answered 23/3, 2021 at 18:57 Comment(0)
N
0

I noticed that the "Precompile during publishing" checkbox in the "File Publish Options" in VS2017 prevented a *.lic file from being included in the deployment despite it being configured as "Content". A *.txt file did not have this problem, so I assume this has something to do with "unknown" file extensions. I'm not sure if this is specific to VS2017 or other versions also have this weird issue. Anyway thought I'd share this because it is very counter-intuitive, seems totally unrelated to that checkbox and might help somebody having similar issues.

Nga answered 22/4, 2017 at 19:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.