1

I have an ASP.NET MVC project that serves static files form its root. I see that these files are marked as Content and Do not copy. Nevertheless, when I hit run in VS the static files are served from the root of the project.

I would really like to gather some static resources in a different project, and have them served as well.

I tried to create a class library and reference it from the main project, but files marked as Content in the class library is not deployed when I hit F5.

Is it possible to serve static files from a different project? If so, how?

Rob
  • 11,492
  • 14
  • 59
  • 94
Vegar
  • 12,828
  • 16
  • 85
  • 151
  • What web server are you using? You could map the second project as a virtual directory in IIS for example at the root of your main project. – LDJ Feb 12 '15 at 09:32
  • It's deployed to a azure cloud service. Locally, we use the azure emulator with either IIS or IIS Express. – Vegar Feb 12 '15 at 10:05

1 Answers1

0

The simplest way to accomplish this is to to add a Post Build Event to your ASP.NET MVC project

Add an xcopy command to "WebApplication1 Properties -> Build Events -> Post-build event command line"

More information: Copy file(s) from one project to another using post build event...VS2010

Unfortunately this won't handle deletes or renames very well.

Community
  • 1
  • 1
Svein Fidjestøl
  • 3,106
  • 2
  • 24
  • 40