6

I’m currently working on “suite” of internal intranet applications

They are all asp.net MVC apps, which will be (for various reasons) deployed as separate apps

I’m currently facing massive amounts of duplication -

Each app has essentially the same “outer” shell This outer shell isn’t just about views, it encompasses authentication logic etc…

The “inner” view is the actual app.

So, in an ideal world, I’d have something like:

MyCompany.Web
Holds the _Layout, base controllers, auth etc…

Then, other mvc projects in my solution such as:

  • MyCompany.Web.App1
    inherits MyCompany.Web

  • MyCompany.Web.App2
    inherits MyCompany.Web

etc…

Is there anything I could sensibly do to facilitate this?

Everything I’ve tried so far involves xcopying views etc.. into sub projects on builds, and feels very fragile.

1 Answer 1

1

Create nuget packages for all assembly based code to be shared.

Consider whether nuget packages make sense for any view or layout file sharing.

Consider making a project template that includes usages of the relevant nuget packages. This will allow you to follow the same pattern MVC itself is taking that you can create a new project and update nuget packages as necessary. This eliminates the need for frequent changes to the template itself, except where changes aren't readily shared by nuget.

Sign up to request clarification or add additional context in comments.

3 Comments

"Consider whether nuget packages make sense for any view or layout file sharing" - that's essentially what i'm trying to do - the layout will remain the same (header, footer etc...) it's just the bit in the middle that changes between applications
@Alex remember that you can have layouts of layouts. Create a master layout that has a section defined for the inner middle, use nuget to share the master layout so it can be easily updated en masse and the project template to define the empty or base skeleton of the inner section. Nuget doesn't handle modifications to package components well, even single characters will usually eliminate the opportunity to do update-package properly (hope this is something they address in the future perhaps with 3 way merging).
Gave this a go, but i'm getting the following problem: stackoverflow.com/questions/26218714/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.