Search code examples
asp.netasp.net-mvcvisual-studiovisual-studio-2013font-face

How to add custom font files to an ASP.NET MVC project in Visual Studio


Everything is working fine locally, but the problem is that the font files I've added aren't showing in Solution Explorer and aren't getting built into the project when I deploy it to my web server, although everything works fine locally.

Because right-clicking on the fonts file in Visual Studio didn't give me any options of using Add for font files, I manually added them to the folder through Windows File Explorer.

Same goes for some Javascript that I added. What am I doing wrong?


Screenshot of situation:

https://i.sstatic.net/7061S.png


Solution

  • You can either add an existing item:

    1. Right click the folder you want to add the files
    2. Hover over Add
    3. Select Existing item
    4. Select the file(s) you would like to add.

    Alternatively, if you've already done it the way you have, you need to add them to the solution file. You can do this manually (bothersome, could end up screwing it up), or, in solution explorer you will see there are icons at the top, there is one that shows all files:

    show all files button

    Now if you navigate to your folder in the solution explorer, you can right click this items and select Include in project