Visual Studio - 资源(CSS / JS /图像)在Web项目之间共享 [英] Visual Studio - Resource (CSS/JS/Images) sharing between web projects

查看:149
本文介绍了Visual Studio - 资源(CSS / JS /图像)在Web项目之间共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

在Visual Studio 2010中处理常见的JavaScript文件

我正在寻找在多个Web项目中共享一个公共的资源池(css / js / images)。我希望做的是为资源创建一个项目文件,例如: Common.WebResources ,并将其包含在Visual Studio解决方案中,用于 Site1 & Site2

I'm looking to share a common pool of web resources (css/js/images) across multiple web projects. What I'm hoping to do, is create one project file for the resources, e.g.: Common.WebResources, and include it in the Visual Studio solutions for Site1 & Site2.

我正在寻求解决的部分是将其设置为使用 VS开发服务器 (在F5上发起的那个),以及任何外部部署问题。

The part I'm looking to solve is setting it up to work with the VS Development Server (the one that gets fired up on F5), and any outer deployment concerns.

所以我们希望结束以下内容项目映射到以下网络目录:

So we're hoping to wind up with the following projects mapped to the following web directories:


  • Site1.Web - /

  • Common.WebResources - / resources

  • Site1.Web - /
  • Common.WebResources - /resources

在IIS中,它将只是一个虚拟目录。到目前为止,VS开发服务器,我只能够:

In IIS, it would just be a virtual directory. So far with VS Development Server, I've only been able to:


  • 让他们部署在不同的端口(不是很多使用)

  • 添加一个post-build事件,将资源的内容复制到Site1.Web

我的问题是:


  • 还有什么其他选择?

  • 你觉得这是最合适的,可用的可维护?

  • What other options are there?
  • Which do you feel to be the most appropriate, usable & maintainable?

(我想在一个单独的项目中资源的原因是避免不断的将主资源位置合并到每个消费站点中,并从每个修补程序合并回来。)

(The reason I'd like the resources in a single, separate project is to avoid having to constantly merge a master resources location into each of the consuming sites, and merging back from each fix we make.)

推荐答案

不幸的是是一个VS似乎跌倒的地方 - 我一直在努力解决类似的问题。

Unfortunately, this is one place where VS seems to fall down - I've been struggling with a similar problem.

您可以尝试的一个选项是将您的资源保留在一个单独的来源控制目录,并且具有预构建步骤,确保目录中的当前副本可见,但不是解决方案的一部分。

One option you can try is to keep your resources in a separate, source controlled directory, and have a pre-build step that makes sure that there's a current copy in a directory visible, but not part of, the solution.

有很多缺点 - 你可能会收到关于缺少css类的警告,我不知道是否启用JavaScript智能感知,所以如果你找到一个解决方案,请确保你更新你的问题!

There are lots of drawbacks to this - you'll probably get warnings about missing css classes, and I'm not sure if javascript intellisense will be enabled, so if you do find a resolution, make sure you update your question!

这篇关于Visual Studio - 资源(CSS / JS /图像)在Web项目之间共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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