0

In a MVC Solution with folders like Content Controllers Scripts Views I was wondering if it was possible to reuse Content and Scripts in another solution, by moving Content and Scripts to a new project, both solutions then could include?

Content:

I'm specially concerned that the files have to lie in Content by some sort of naming convension, or maybe I can just configure it so it's no problem.

JavaScripts:

Regarding the scripts I think I can solve it this way, by following this SO answer. How do you share scripts among multiple projects in one solution

Community
  • 1
  • 1
radbyx
  • 9,352
  • 21
  • 84
  • 127
  • 1
    We share static content using IIS virtual directories. Really dont see it as a problem becuase its set up as part of the same powershell script that creates the application pool and websites. What content in your content folder are you explicitly wanting to share? You can use the Visual Studio 'Add as link' to add content from another project – LDJ Oct 27 '16 at 08:51
  • I want to use it all in Content. Yes I'll give "Add as link" a try now, it sounds good. The idea is that the second solution is "self hosting(so without an IIS), so I hope that part doesn't make an issue :) – radbyx Oct 27 '16 at 08:58
  • 1
    No, the add as link will compile it locally into the project but allows you to only have one physical copy of the source on disk, so you dont have to check copies into each project into source control – LDJ Oct 27 '16 at 09:00

1 Answers1

0

Yes it's possible, but you would probably have to play with the ViewEngine.

See https://weblogs.asp.net/imranbaloch/view-engine-with-dynamic-view-location to have an idea of what can be done.

Toine Seiter
  • 437
  • 4
  • 20
  • In my current solution I have a project with the public front end in a project, the admin area in an other project and some plugins in other projects. all this VS project contains controllers, views, static files, etc... – Toine Seiter Oct 27 '16 at 09:16