如何在多个解决方案之间共享常见的JS文件? [英] How do I share common JS files between multiple solutions?

查看:121
本文介绍了如何在多个解决方案之间共享常见的JS文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在两个解决方案中有两个MVC项目,它们将具有相当的外观和感觉,但功能却截然不同.因此,他们有不同的解决方案来管理他们的代码.一切都存储在TFS存储库中.

I currently have two MVC projects in two solutions which will share a fair bit of look and feel but very different functionality. As such they have different solutions to manage their code. Everything is being stored in TFS repositories.

当前,任何共享的C#代码都是通过类库进行管理的,尽管这对C#代码很有用,但似乎没有类似的方法可以对JavaScript或CSS文件执行此操作.是否有最佳实践方法来专门处理TFS中单独的解决方案之间的共享JS和CSS文件,或者通常只解决方案文件中的共享JS和CSS文件?

Currently any shared C# code is managed through class libraries and while this is great for the C# code there doesn't appear to be a similar way to do this for JavaScript or CSS files. Is there a best practices way to handle shared JS and CSS files between separate solutions in TFS specifically or just in solution files in general?

为明确我的意思,当我说共享"时,它应具有以下条件:

To be clear what I mean when I say "shared," it should have the following criteria:

  1. 两个解决方案中文件的名称相同.
  2. 在解决方案A中编辑文件会导致将这些更改应用于解决方案B中的文件.
  3. 理想情况下,这对开发人员是透明的.

推荐答案

您可以创建一个包含所有共享的.js和.css文件的单独项目(例如,"CommonJsCss").然后只需将该项目同时包含在解决方案A和解决方案B中即可.

You can create a separate project (say "CommonJsCss") that contains all of the shared .js and .css files. Then just include that project in both Solution A and Solution B.

这篇关于如何在多个解决方案之间共享常见的JS文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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