我如何重写CopyLocal(私人)设置MSBuild中的.NET引用 [英] How do I override CopyLocal (Private) setting for references in .NET from MSBUILD
问题描述
我一直在摔跤这个几天和成吨的搜索,我找不到我应该上的路径后。
I have been wrestling with this for a few days and after tons of searching I can't find the path I should be on.
我想要做的是建立一个MSBuild项目,将建立我们的整个.NET应用程序(8解决方案constst,也许250个项目拆分之间)与一些设置在单独的项目文件覆盖,使什么调试版本为我自己。
What I want to do is set up an MSBUILD project that will build our entire .NET application (constst of 8 solutions, and maybe 250 projects split up between them) with a number of settings overridden from the individual project files to make a debug build for myself.
我特别想建立我们与优化起飞和完整的调试信息发布配置/ PDBS产生。此外,为了减少我们目前超长的编译时间我想复制本地(或私人在实际的PROJ文件的XML)假每一个项目的每一个参考。
Specifically I want to build our release configuration with optimizations off and full debug info / pdbs generated. Also, in order to reduce our currently ultra-long build time I want "copy local" (or private in the actual proj file xml) false for every reference of every project.
第一件事是相当容易的,我可以覆盖项目级属性很容易(从MSBuild的命令行中使用/对你甚至可以做到这一点),但我无法弄清楚是如何覆盖一个属性上参考。我曾尝试我在这里看到的计算器和整个网络的几件事情,但没有什么是解决呢。
The first things were fairly easy, I can override a project level property fairly easily (you can even do this from the MSBuild command line using /p), but what I can't figure out is how to override a property on a reference. I have tried several things I saw here on StackOverflow and around the web, but nothing is a solution yet.
我可以做我想做的通过改变Microsoft.Common.targets,注释掉了code在_CopyFilesMarkedCopyLocal目标完全跳过这些文件的复制。但我不想改变我的全球配置,并为此在所有情况下。我创造了我自己的备用目标文件 - 这工作,如果我改变一个人的项目文件指向它 - 但我无法弄清楚如何指定在顶层(我.proj文件,只是建立使用所有8个方案)。这将是巨大的,如果我能在最顶层以某种方式覆盖只是_CopyFilesMarkedCopyLocal目标,这样,如果MS改变默认的目标文件,我的版本是不是做错了,但我无法弄清楚如何使这项工作无论是。
I can do what I want by altering Microsoft.Common.targets, commenting out the code in the _CopyFilesMarkedCopyLocal target completely skips the copying of these files. But I don't want to alter my global configuration and do this in all circumstances. I created my own alternate targets file -- which works if I alter an individual project file to point to it -- but I can't figure out how to specify this to be used at the top level (my .proj file that just builds all 8 solutions). It would be great if I could somehow override just the _CopyFilesMarkedCopyLocal target at the top level so that if MS changes the default targets file my build isn't screwed up, but I can't figure out how to make this work either.
在最好的事情是,如果有一种方法只是覆盖参考电平性能,如你可以项目级别属性,而无需重写/覆盖的构建目标的东西 - 但我没有发现任何资料表明这是可能的。
The best possible thing would be if there was a way to just override reference level properties like you can project level properties, without having to rewrite/override the build targets stuff -- but I have found no information indicating this is possible.
在此先感谢有这方面的帮助。
Thanks in advance for any help on this.
P.S。它是不可能对我来说,实际上只是通过所有的项目文件,并对其进行更改;我需要一个解决方案,保留现有的code到位原样。
P.S. It is not possible for me to actually just go through all the projects files and change them; I need a solution that leaves the existing code in place as is.
推荐答案
试试这个:
将 CustomAfterMicrosoftCommonTargets 到C:\富\ filter.targets的(或任何你命名该文件)的,并有filter.targets是:
Set the CustomAfterMicrosoftCommonTargets to C:\foo\filter.targets (or whatever you name the file) and have filter.targets to be:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<Reference>
<Private>False</Private>
</Reference>
</ItemDefinitionGroup>
</Project>
这篇关于我如何重写CopyLocal(私人)设置MSBuild中的.NET引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!