Web publishing in ASP.Net does not publishes for following file formats
Asked Answered
A

3

5

I am trying to publish a web site, in which css directory includes different files for font settings.

Following are the file & extensions:

 calibri-webfont.eot
 calibri-webfont.svg
 calibri-webfont.ttf
 calibri-webfont.woff
 calibri-webfont.oft

Now when I try to publish website, it just publishes .svg file,other files I need to copy manually. Whiles publishing following options I have checked:

  1. Replace matching files with local copy
  2. Only files needed to run this application.

Expected: as all those files are required, I want those to be get published automatically, than manually coping those.

How this can be achieved?

Amanuensis answered 15/3, 2013 at 4:54 Comment(6)
Have the files in question been included in the project? I don't just mean sitting in the directory, or included in source control, but actually included in the ASP.NET project.Phosphate
Yes, those are actually included in project! But still causing this issue.Amanuensis
In the Properties pane for each file, is Build Action set to "Content"?Phosphate
No.. Its not.. only for svg files its "Content". Is it problem? can you please brief it meaning/ use. n thanks for quick reply!Amanuensis
Yes, they have to be set to "Content". The Publish task will ignore files that are not set to "Content" when it creates the zip file.Phosphate
It works, Thanks a lot! Please add your comment as answer so that I can mark it as expected solution.Amanuensis
C
7

I know you asked this a very long time ago, but today it ranks high on Google and I've just had the same problem. Today's fix was that Azure does not have MIME types configured for several font file formats. This must be added to web.config otherwise Azure simply returns a 404 error (even though the files are actually published).

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

Source: http://www.codepal.co.uk/show/WOFF_files_return_404_in_Azure_Web_Sites

Corticosteroid answered 17/2, 2014 at 13:22 Comment(2)
This is an answer to another question. The original is about copying files. This one is about IIS/Azure not serving the files out. Not sure if it should be an answer to this question, though I know they are related.Brahman
@SamiKuhmonen I take your point, but not necessarily. When I had the same problem, I was convinced that the files had not copied, when in fact the problem was with the MIME mappings - the files had copied just fine. There is no reason that WebPublish would not copy these files, is there? If the OP can confirm the files aren't at the destination by another method (e.g. FTP), then it might add clarity to the root issue.Corticosteroid
F
3

If your files are not included in the project (just in the file structure), in visual studio click the Show All Files Icon in the solution Explorer (looks like 3 pages). Right Click on the files and select "Include in Project"

Access the file properties by right clicking, then make sure the Build Action property is set to "Content".

Feeley answered 15/3, 2013 at 5:5 Comment(2)
You do have to include them in the project (otherwise you can't specify the build action, and the Package task won't know the files are there). You don't have to "copy [them] to output directory", however.Phosphate
@HackedByChinese you are correct...memory failure on my part. Thought I had done this without including the files in the project! Amending...Feeley
A
0

file properties by right clicking, then make sure the Build Action property is set to "Content".

Works fine

Arizona answered 29/3, 2017 at 5:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.