I am using a pre-build task in Visual Studio 2008 that invokes msbuild:
C:WINDOWSMicrosoft.NETFrameworkv3.5MSBuild.exe $(MSBuildProjectDirectory)version.targets /p:Configuration=$(ConfigurationName)
Inside version.targets, I am updating the AssemblyInfo.cs file to replace version information:
<FileUpdate
Encoding="ASCII"
Files="$(MSBuildProjectDirectory)PropertiesAssemblyInfo.cs"
Regex="AssemblyInformationalVersion(".*")]"
ReplacementText="AssemblyInformationalVersion("Product $(ConfigurationString) ($(buildDate))")]"
/>
When I build the project through Visual Studio 2008, it builds without any problems.
But when I look at the resulting exe's version information, it contains the previous time stamp even though the AssemblyInfo.cs has been changed with the "correct" one.
It seems that the pre-build's changes aren't seen by the main compilation task and it's always one behind.
Any ideas of what I'm doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…