MsBuild:将引用从ProjectReference更改为Reference [英] MsBuild: Changing References from ProjectReference to Reference

查看:140
本文介绍了MsBuild:将引用从ProjectReference更改为Reference的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的环境中,我们有两个内部框架和一个单独的网站.在开发过程中,对内部框架的引用倾向于设置为tp项目引用.但是,一旦我们发布了版本,内部框架就会安装到GAC中,因为它们用于每台服务器上网站的多个实例.手动将所有ProjectReferences更改为References,并重新编译和部署网站程序集和网站.

In our environment, we have two in-house frameworks and a separate website. During development, the references to the in-house frameworks tend to be set tp project references. However, once we move to release, the in-house frameworks are installed into the GAC as they are used for multiple instances of the website on each server. All of the ProjectReferences are changed, by hand, to References and the website assemblies and website are re-compiled and deployed.

我正在尝试自动执行此过程.处理这些问题的最佳方法是什么?我已经开始学习MsBuild来尝试实现这一目标,但是我完全感到困惑.有关如何进行操作的任何指示和/或建议?

I am attempting to automate this process. What is the best way to handle these issues? I have started to learn MsBuild in the attempt to accomplish this, but am totally confused. Any pointers and/or suggestions on how to proceed?

推荐答案

据我所知,不应仅仅因为程序集已在GAC中注册而将使用项目引用更改为文件引用.只要所引用的项目在构建时就已被强类型键入,则该引用仍应有效.

As far as I am aware there shouldn't be any need to change from using project references to file references simply because the assembly is registered in the GAC - as long as the referenced project is strongly typed at the point that it is built, the reference should still be valid.

说明:

GAC引用和文件引用之间没有根本区别-如果您具有对重命名程序集的引用,并且该程序集已放置在GAC中,则最终应用程序将从GAC加载该程序集.

There is no fundamental difference between a GAC reference and a file reference - if you have a reference to a strongly named assembly, and that assembly is placed in the GAC then the end application will load that assembly from the GAC.

有关运行时如何查找引用程序集的更多信息,请参见以下链接:

See this link for more information on how the runtime locates referenced assemblies:

仅供参考-我相信建议您不要引用物理上位于GAC中的程序集,而是在将其命名为GAC之前先引用强命名的程序集(而不是与是否应将组件安装到最终用户计算机上的GAC上混淆)

FYI - I believe it is recommended that you don't reference assemblies which are in physically in the GAC, and that you instead reference the strongly named assembly before it is placed in the GAC (not to be confused with whether or not the assembly should be installed to the GAC on the end-user machine)

这篇关于MsBuild:将引用从ProjectReference更改为Reference的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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