我有一个大型项目,由几个解决方案组成,所有解决方案都包含独特和共享项目的组合。使用MSBuild Extension Pack和AssemblyInfo自动执行版本号,为什么添加到现有项目时会失败?
我试图让他们都拥有相同的自动递增版本号,当我运行我所有的解决方案的批处理构建。
前两位需要固定,后两位自动增量。
这似乎是在MSBuild扩展包
的集信息类的默认行为,所以我跟着这里的指南:http://www.msbuildextensionpack.com/help/3.5.12.0/html/d6c3b5e8-00d4-c826-1a73-3cfe637f3827.htm
而且我主要是难以得逞的。
如果我下面的行添加到一个简单的,全新的测试项目:
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.VersionNumber.targets"/>
它工作正常。每次在VS中构建项目时,都会更新版本号。
不过,如果我添加了完全相同的行的第一个项目在我现有的解决方案,我得到以下错误:
Unable to update the AssemblyFileVersion for AssemblyInfo.cs: No stub entry for AssemblyFileVersion was found in the AssemblyInfo file.
AssemblyInfo.cs中的内容是:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("02ecd067-a91c-44bc-a486-a7b097157757")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
几乎完全相同的工作测试版本:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("AutoVersionTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("AutoVersionTest")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("33c1d540-f9c4-4cc5-86ed-9d8695bf7b4d")]
[assembly: AssemblyVersion("1.0.0103.01")]
[assembly: AssemblyFileVersion("1.0.0103.01")]
那么为什么它在一个BU不是另一个?
我只是在黑暗中刺中,但我会确保AssemblyInfo.cs文件在物理上是在项目中,而不是从另一个项目链接。 – BryanJ
被刺伤,文件夹中有两个AssemblyInfo.cs文件,一个在根目录中,一个在属性中。项目中只有一个属性。但是,如果我删除了根目录中的一个(从VS2003中保留),则错误将更改为AssemblyInfo.cs未找到。我刚刚删除的文件中没有AssemblyFileVersion。 – RoboJ1M
和VS2008的快速重启,现在它可以工作。 – RoboJ1M