使用ASP.net MVC项目作为"基地"项目其他的MVC项目 [英] Using an ASP.net MVC project as a "base" project for other MVC projects

查看:122
本文介绍了使用ASP.net MVC项目作为"基地"项目其他的MVC项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在对内部的Intranet应用程序套件

I’m currently working on "suite" of internal intranet applications

他们都是asp.net MVC应用程序,这将是(因各种原因)部署为单独的应用

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 结果
举行的_layout,基本控制器,身份验证等...

然后,在我的解决方案的其他MVC项目,例如:

Then, other mvc projects in my solution such as:


  • MyCompany.Web.App1 结果
    继承MyCompany.Web

MyCompany.Web.App2 结果
继承MyCompany.Web

等等......

有什么我可以做理智方便呢?

Is there anything I could sensibly do to facilitate this?

一切到目前为止,我已经试过涉及xcopying意见等。成子工程的构建,感觉非常脆弱的。

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

推荐答案

所有基于组装code被共享创建的NuGet包。

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

考虑的NuGet包是否有意义任何视图或布局的文件共享。

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

考虑将包含相关的NuGet包用途项目模板。这将允许您遵循相同的模式MVC本身正在你可以创建一个新的项目,并根据需要更新的NuGet包。这消除了需要频繁变更模板本身,除非改变不易被的NuGet共享

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.

这篇关于使用ASP.net MVC项目作为"基地"项目其他的MVC项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆