使用 AssemblyInfo 自动更新多个 AssemblyInfo.cs 文件 [英] Using AssemblyInfo to automatically update multiple AssemblyInfo.cs files

查看:27
本文介绍了使用 AssemblyInfo 自动更新多个 AssemblyInfo.cs 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将多个 AssemblyInfo.cs 文件作为单个解决方案中许多项目的一部分,作为 TeamCity 的一部分自动构建.

I've got several AssemblyInfo.cs files as part of many projects in a single solution that I'm building automatically as part of TeamCity.

为了使 msbuild 脚本更易于维护,我希望能够将 AssemblyInfo 社区任务与 ItemGroup 结合使用,例如

To make the msbuild script more maintainable I'd like to be able to use the AssemblyInfo community task in conjunction with an ItemGroup e.g.

<ItemGroup>
     <AllAssemblyInfos Include="..**AssemblyInfo.cs" />
</ItemGroup>

<AssemblyInfo AssemblyTitle="" AssemblyProduct="$(Product)" AssemblyCompany="$(Company)" AssemblyCopyright="$(Copyright)" 
                  ComVisible="false" CLSCompliant="false" CodeLanguage="CS" AssemblyDescription="$(Revision)$(BranchName)" 
                  AssemblyVersion="$(FullVersion)" AssemblyFileVersion="$(FullVersion)" OutputFile="@(AllAssemblyInfos)" />

这显然不起作用,因为 OutputFile 不能是引用的 ItemGroup.

Which blatently doesn't work because OutputFile cannot be a referenced ItemGroup.

有人知道怎么做吗?

推荐答案

尝试如下将@改为%

<ItemGroup>
 <AllAssemblyInfos Include="..**AssemblyInfo.cs" />
</ItemGroup>

<AssemblyInfo AssemblyTitle="" AssemblyProduct="$(Product)" AssemblyCompany="$(Company)" AssemblyCopyright="$(Copyright)" 
                              ComVisible="false" CLSCompliant="false" CodeLanguage="CS" AssemblyDescription="$(Revision)$(BranchName)" 
                              AssemblyVersion="$(FullVersion)" AssemblyFileVersion="$(FullVersion)" OutputFile="%(AllAssemblyInfos)" />

这会为 AllAssemblyInfos 中的每个条目创建一个调用.

This creates a call for every entry in AllAssemblyInfos.

也看看这篇文章,应该会有所帮助.

Have a look at this article too, should help.

http://blogs.msdn.com/aaronhallberg/archive/2006/09/05/msbuild-batching-generating-a-cross-product.aspx

这篇关于使用 AssemblyInfo 自动更新多个 AssemblyInfo.cs 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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