[RESOLVED]My art folder didn't publish, but it runs locally, where did this process go wrong?

This is a simple beginner question…

I’m starting to use MVC 5 and I wanted to add a graphic, so I created a folder in the solution (Art) and I used File Explorer to copy a graphic to the folder. I was able to reference the graphic in an img tag, and it displays on the page when I view it on
the development machine. After publishing, the graphic didn’t appear. 

I suspect I added the file incorrectly, and now the solution doesn’t properly recognize the art, so it wasn’t uploaded. The other hint of this is that in solution explorer, it won’t show the art file (but it’s visible under file explorer).

How should I have added in this graphic, so that solution explorer sees it, and uploads it?

After making this post, I saw the option to publish art (an option when right clicking the art folder), and then it was uploaded. Still, I think my process was wrong, because I think the whole project should have uploaded when I published the solution.

It would be great if someone could explain the intended process for publishing, and why I have to publish this folder separately.

Hi JeffLeese,

In the solution explorer, click show all files. This will list all the files, Right click on the required file/folder and click Include into project. Save the project.

Another thing to do is right click the missing file, select Copy to output directory as Copy Always

Hi,

       Whenever you are copying file to your solution make sure it appears in there. If solution is not showing that file even after copying then just select the Folder(Image folder or Project) and on the top of solution explore you can find "show all files"
icons, click that and now your files will be appeared in your solution but in faded color because it is not yet included in project. so right click on file(s) and select "Include In Project", that’s it.  Now you can publish your project and host to IIS.

Thanks, 

Avishek

Mark as Answer, if it helps you.

Hi JeffLeese,

Thanks for your post.

I believe you need to set the folder’s "Build Action" to "Content":

What are the various "Build action" settings in VS.NET project properties and what do they do?

Hope this can be helpful.

Best Regards,

Eileen

Leave a Reply