设置构建依赖项而不使用引用? [英] Setting up a build dependency without using a reference?

查看:140
本文介绍了设置构建依赖项而不使用引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部: 我正在研究一种解决方案,其中的一个项目实际上是该解决方案构建的主要exe的插件.由于该项目是一个插件,因此从主exe引用该插件是错误的(不能保证程序集中存在该程序集,这是可选的).

All: I am working on a solution where one of the projects is actually plug-in to the main exe that the solution builds. Since this one project is a plug in, it's wrong to reference the plug-in from the main exe (that assembly isn't guaranteed to be present in a deployment, it's optional).

这是我的问题: 如果我修改了插件项目中的代码,然后按F-5键运行,Visual Studio将不会继续构建我的插件(由于基于引用树,因此主要exe文件似乎并不依赖于它).

So here's my problem: If I modify code in my plug-in project, and then hit F-5 to run, Visual Studio will not alwyas build my plug-in (since based upon the reference tree, the main exe does not appear to depend upon it).

是否存在可以更改的解决方案或项目级别设置,以使我在运行时包含此插件项目(无需添加引用)?

Is there a solution or project-level setting that I could change to cause this plug-in project to be included when I run (without adding a reference)?

我了解工具的全局设置|选项| Build and Run,但我不想为了使此解决方案正确构建而不必全局更改VS的行为(此外,如果设置与解决方案或项目一起进行,那么当其他开发人员签出该解决方案或项目时,他们应该简单地继承设置)

I know about the global setting in tools | options | Build and Run, but I'd rather not have to change VS's behavior globally just to get this solution to build right (also, if the setting goes with the solution or project, then when other developers check it out, they should simply inherit the setting)

顺便说一句:这些是VS 2005解决方案中的c#项目.

BTW: these are c# projects in a VS 2005 solution.

推荐答案

在解决方案资源管理器->属性->项目依赖关系中右键单击根节点. (VS 2008用户:此功能有其自己的对话框,可从上下文菜单直接访问该对话框.)

Right click the root node in Solution Explorer -> Properties -> Project Dependencies. (VS 2008 users: this feature gets its own dialog box that's directly accessible from the context menu.)

依赖性图表示为复选框的邻接表.您选择的每个项目都将选中其直接引用.已禁用[假设您使用项目引用,而不是程序集引用].如果其他复选框会产生循环依赖关系,则它们可能会被禁用.

The dependency graph is represented as an adjacency list of checkboxes. Each project you select will have its direct references checked & disabled [assuming you use project refs, not assembly refs]. Other checkboxes might be disabled if they would create a circular dependency.

对于未禁用的任何复选框,选中/取消选中会将 ProjectSection(ProjectDepedencies)部分写入解决方案文件.因此,您的设置将通过源代码控制传播到其他开发人员.

For any checkbox not disabled, checking/unchecking will write a ProjectSection(ProjectDepedencies) section into your solution file. So your settings will propagate to other developers via source control.

尽管有这样的警告:如果您使用MSBuild(包括Team Build的任何版本),它并不总是以与Visual Studio内部构建相同的方式处理* .sln文件定制. * .sln不是本机MSBuild文件类型,与*.?? proj文件不同.我自己遇到了问题在此描述;我还偶尔看到过相反行为.

Fair warning though: if you use MSBuild (including any version of Team Build), it does not always handle *.sln file customizations the same way that builds inside Visual Studio do. *.sln is not a native MSBuild file type, unlike *.??proj files. I myself have run into the problem described here; I've also seen the opposite behavior on occasion.

这篇关于设置构建依赖项而不使用引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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