如何使用 ProjectReference 引用项目的多个输出

发布于 2025-01-14 19:17:34 字数 149 浏览 3 评论 0原文

假设项目 A 生成一个主要程序集,但也通过使用(我们自己制作的)MSBuild 任务生成一些程序集。

有没有一种方法可以让项目 B(具有对项目 A 的 ProjectReference)也可以引用任务生成的程序集,而无需进行太多修改(我知道,这是相当相对的概念;-))?

Assume Project A produces a primary assembly but also some assemblies through the use of an MSBuild task (of our own making).

Is there a way for Project B, that has a ProjectReference to Project A, to also reference the assemblies that are produced by the task without hacking too much (I know, quite relative concept ;-))?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烛影斜 2025-01-21 19:17:34

按照惯例,项目有一个负责生成的主要目标,尽管该目标可以是多个相关文件。例如,MyLib.csproj 可能会生成一个 MyLib.dll,并支持 MyLib.pdbMyLib.dll.config文件。通常,与项目目标名称匹配的某些已知文件扩展名的文件会关联在一起。

ProjectReference 将引入所引用项目的主要目标程序集、与目标程序集直接关联的文件(例如 .pdb 和 .config)以及一个深度的程序集(及其关联文件)。由主要目标组件链接。

如果您创建了一个具有“多个输出”的项目,那么您还必须创建引用“多个输出”的支持。

By convention a project has one primary target that it is responsible for producing, although that can be multiple related files. e.g. A MyLib.csproj may produce a MyLib.dll with supporting MyLib.pdb and MyLib.dll.config files. In general, files of certain known file extensions that match the name of the project target are associated together.

A ProjectReference will bring in the primary target assembly of the referenced project, files directly associated with the target assembly (e.g. the .pdb and .config), and one depth of assemblies (and their associated files) that are linked to by the primary target assembly.

If you have created a project with 'multiple outputs' then you will also have to create the support to reference the 'multiple outputs'.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文