Welcome to MSDN Blogs Sign in | Join | Help

How To: Remove the Up-To-Date Check From the AssemblyInfoTask

Every couple of weeks I get mail from someone who is using the AssemblyInfoTask on a build machine under source control. The question typically goes like this:

I added the .targets file to my project, and it works fine on my dev machine, but doesn't do anything when I'm running it in the build lab. What's wrong? Help!

The reason it "doesn't do anything" is because the default Microsoft.VersionNumber.Targets file includes MSBuild attributes that instruct the build engine to check timestamps on input and output files. These were added because it doesn't make much sense to increment the version number on an assembly if nothing is gettting re-built. This can happen if MSBuild does an incremental build on the project.

In the build lab, however, all of the input files (.cs files, generally) and the output file (assemblyinfo.cs) wind up with the same timestamps when they are synchronized from the soruce code control server.

To resolve this, simply remove the Inputs and Outputs attributes from the <Target> tag in the Microsoft.VersionNumber.Targets file. It should wind up looking like this:

<Target Name="UpdateAssemblyInfoFiles">

[ Author: Neil Enns ]

Published Tuesday, March 28, 2006 9:57 PM by msbuild

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Thursday, March 30, 2006 2:06 PM by Ron

# re: How To: Remove the Up-To-Date Check From the AssemblyInfoTask

I removed the Inputs and Outputs attributes from the <Target> tag in the Microsoft.VersionNumber.Targets file.  The major version, minor version, and build number update correctly; however, the revision number remains 0 even after making a change to the source code and rebuilding.

I have the following entries in the AssemblyInfo.vb file:
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: AssemblyVersion("1.0.0.0")>

I have the following entries in the TFSBuild.proj file:
<PropertyGroup>
<AssemblyMajorVersion>1</AssemblyMajorVersion>
<AssemblyFileMajorVersion>1</AssemblyFileMajorVersion>
<AssemblyMinorVersion>0</AssemblyMinorVersion>
<AssemblyFileMinorVersion>0</AssemblyFileMinorVersion>
</PropertyGroup>

Adding an <AssemblyRevision>1</AssemblyRevision> tag to the TFSBuild.proj <PropertyGroup> tag made no difference.

Please advise.
Monday, April 03, 2006 1:34 AM by Neil

# re: How To: Remove the Up-To-Date Check From the AssemblyInfoTask

Ron, are you importing Microsoft.VersionNumber.Targets?
Wednesday, April 05, 2006 12:49 PM by Ron

# re: How To: Remove the Up-To-Date Check From the AssemblyInfoTask

The issue was caused by the fact that we were not saving the updated AssemblyVersion.vb files back to the source control system.
Tuesday, April 11, 2006 2:47 PM by Ram

# re: How To: Remove the Up-To-Date Check From the AssemblyInfoTask

Where is the AssemblyInfoTask defined? I can't find the Microsoft.VersionNumber.Targets file. Is this target file installed in a separate location from the other target files?
Monday, April 17, 2006 5:14 PM by msbuild

# re: How To: Remove the Up-To-Date Check From the AssemblyInfoTask

It gets installed under c:\program files\msbuild\assemblyinfotask.

Neil
Wednesday, April 19, 2006 9:36 PM by Adrigo

# re: How To: Remove the Up-To-Date Check From the AssemblyInfoTask

I am creating an continous build environment using CC.NET. CC polls my SVN repo for every 30 seconds, and builds if there any modifications.  

When I check-out code from the source control repository, I change the version numbers for all AssemblyInfo.cs files in my check-out directory. I commit the changed source back in the repository so that the AssemblyInfo.cs files accurately reflect the correct version.

But, CC.NET kicks of the check-out again because it obviously assumes that the AssemblyInfo.cs files that it committed just now constitute a change in the repo! The cycle continues ad infinitum.

Can somebody else tell me how they are managing this ?
Tuesday, May 09, 2006 1:26 AM by alan

# re: How To: Remove the Up-To-Date Check From the AssemblyInfoTask

attribute magic pro changes and modifys date, time and attributes of files and folders.

http://www.yaodownload.com/utilites/file-disk-management/attributemagic/
Friday, September 01, 2006 9:31 AM by Jack

# re: How To: Remove the Up-To-Date Check From the AssemblyInfoTask

I'm using this Task for code managed by Subversion.  However I am faced with this probelm:

When the task is used on any project not in source control it operates as normal, i.e. the revision number is only updated when a change is made and a build required.

However if the task is used on any project under source control, it is run on every build and the Assembly Info updated with each build. Even if no code has been changed.

Anyone else experience this?
Tuesday, September 12, 2006 5:44 PM by Biggles the Wonder Lama

# re: How To: Remove the Up-To-Date Check From the AssemblyInfoTask

The output file (assemblyinfo.cs) should not be in revision control.  Only the input files (source, build scripts, configuration files) belong in source control.  The build machine should syncronize with the repository and then build the generated files.
Wednesday, January 17, 2007 5:50 PM by Steven Smith

# CCNET with MSBuild and AssemblyInfoTask

This afternoon I embarked on a quick (hah!) task to fix a problem with my CC.NET implementation. I&rsquo;m

Friday, February 01, 2008 11:31 PM by Jimboh

# re: How To: Remove the Up-To-Date Check From the AssemblyInfoTask

If the Assembly.cs file is not in source control then where is it ?

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker