注射程序集的版本号在构建时版本号、程序

由网友(月亮上的笑颜√)分享简介:我想通过把它当作MSBuild的命令行上的属性来改变C#项目在构建时的程序集版本号。I want to change the assembly version number of a C# project at build time by passing it as a property on the MSBuild...

我想通过把它当作MSBuild的命令行上的属性来改变C#项目在构建时的程序集版本号。

I want to change the assembly version number of a C# project at build time by passing it as a property on the MSBuild command line.

集信息工作将在编译之前修改里面的AssemblyInfo.cs的程序集版本。这几乎是我想要的。问题是我不希望因为源代码控制问题的AssemblyInfo.cs改变。我不希望所有这些AssemplyInfo.cs文件显示为被修改,并需要在每一个我们做一个生成时进行检查。

AssemblyInfo Task will modify the assembly version inside a AssemblyInfo.cs before compiling. This is nearly what I want. The problem is I don't want AssemblyInfo.cs to be changed because of source control issues. I don't want all these AssemplyInfo.cs files to show as being modified and needing to be checked in every time we do a build.

我想是一个东西,改变的程序集版本号编译之后 - 也许使用后生成的编织任务。请问这样的东西存在的地方无论是作为开源或零售产品?如果没有,可以有人点我的文档编写后生成韦弗任务?

What I would like is a "thing" that changes the assembly version number after compilation - perhaps using a post build weaving task. Does such a "thing" already exist somewhere either as open source or a retail product? If not, can someone point me to documentation for writing a post build weaver task?

推荐答案

由于的AssemblyVersion 不会弄熟到您的装配在编译时,在 AssemblyInfo.cs中文件与当前版本号不属于源头控制。

Since the AssemblyVersion does get cooked into your assembly at compile time, the AssemblyInfo.cs file with the current build number does belong in source control.

如果您的问题与源代码控制存储,这是因为你不想万吨需要被更新的文件,试试这个。

If your issue with storing this in source control is because you don't want tons of files that need to be updated, try this.

您可以在您的解决方案建立联系,使所有项目指向一个单一的文件,例如: SharedAssemblyInfo.cs 。下面是一个页面描述了这个过程:

You can establish links in your solution so that all projects point to a single file, e.g. SharedAssemblyInfo.cs. Here is a page describing this process:

http://blogs.msdn.com/b/jjameson/archive/2009/04/03/shared-assembly-info-in-visual-studio-projects.aspx

您可以使用集信息任务使用 SharedAssemblyInfo.cs 文件你知道已经,这将是一个需要重新检入源控制的唯一文件。

You can use the SharedAssemblyInfo.cs file using the AssemblyInfo task that you know about already, and this will be the only file that needs to be checked back into source control.

阅读全文

相关推荐

最新文章