Team System Developer Center > Visual Studio Team System Forums > Team Foundation Server - Build Automation > Label is out of sync with Build number that is being generated with AssemblyInfo Task (Failure in GenCheckinNotesUpdateWorkItems)
Ask a questionAsk a question
 

AnswerLabel is out of sync with Build number that is being generated with AssemblyInfo Task (Failure in GenCheckinNotesUpdateWorkItems)

  • Monday, October 19, 2009 7:59 PMHKWest Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    (Failure in GetChangeSetsAndUpdateWorkItems: GenCheckinNotesUpdateWorkItems - labeling out of sync with Build Numbering)

    Hello,
    We are using TFS 2005, and are using AssemblyInfo Task to help with Assembly versioning & Build Numbering.  The assembly & build numbering are working correctly and generating numbers in the following format: 1.0.xxx.yyy

    However, the labeling that occurs is different and out of sync from the above.
        Label DbgBld2_20091019.1@/BLDMACHINE2_HostedBugbash_DbgBld2 is successfully created

    I would like to have the same label numbers as the build number 1.0.xxx.yyy, but that does not seem to be happening, and we also would like to know/track the associated changesets & workitems. (This is where the failure is occuring with my existing TFSBuild.proj).

    Can someone provide feedback on how we can get the labeling synced up with the build numbering?  Your feedback is immensely appreciated!!!

    I am following the guidelines provided by:
    Etienne's VSTS World (http://geekswithblogs.net/etiennetremblay/archive/2008/10/03/matching-tfs-build-labels-with-custom-build-number.aspx)
    Using AssemblyInfo task with Team Build (Gautam Goenka - MSFT - http://blogs.msdn.com/gautamg/archive/2006/01/04/509146.aspx)

    Here is what I see in the output log...
    Target CoreLabel:
        Label Name="DbgBld2_20091019.1" Recursive=True Version="WBLDMACHINE2_HostedBugbash_DbgBld2" Child="replace" Workspace="BLDMACHINE2_HostedBugbash_DbgBld2" Files="$/HostedBugbash"
        Label DbgBld2_20091019.1@/BLDMACHINE2_HostedBugbash_DbgBld2 is successfully created
    Target CoreCompile:
        Creating directory "D:\TFSBld\HostedBugbash\DbgBld2\BuildType\..\Sources\..\Binaries".
       
       
    Target AfterCompile:
        Removing directory "\\BLDMACHINE2\TFSBldOutput\DbgBld2_20091019.1".
        UpdateBuildNumberDropLocation BuildNumber='1.0.08.16' DropLocation='\\BLDMACHINE2\TFSBldOutput\1.0.08.16'
       
       
        Build Uri set to "vstfs:///Build/Build/10192009_190029_87427"
        Build number set to "1.0.08.16"
        "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.com" "D:\TFSBld\HostedBugbash\DbgBld2\BuildType\..\blah\foo.sln" /build Debug
    ...
    ...
    Copying file from "D:\TFSBld\HostedBugbash\DbgBld2\BuildType\..\blah\bin\foo.dll" to "D:\TFSBld\HostedBugbash\DbgBld2\BuildType\..\blah\..\Binaries\Debug\foo.dll".

    "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\..\tf.exe" checkin /comment:"Auto-Build: Version Update" /noprompt /override:"Auto-Build: Version Update" /recursive AssemblyInfo.vb
        foo\bar:
        Checking in edit: AssemblyInfo.vb
    ...
    ...

    Target GetChangeSetsAndUpdateWorkItems:
        GenCheckinNotesUpdateWorkItems TeamFoundationServerUrl="http://MYTFSSERVER:8080/" CurrentLabel="L1.0.08.16@$/HostedBugbash" LastLabel="L1.0.07.15@$/HostedBugbash" UpdateWorkItems=True BuildId="1.0.08.16"
        Querying the contents of label 'L1.0.07.15@$/HostedBugbash'.
        MSBUILD : warning : Error: Cannot find specified label '1.0.07.15' in scope '$/HostedBugbash'.
        The previous error was converted to a warning because the task was called with ContinueOnError=true.
        Build continuing because "ContinueOnError" on the task "GenCheckinNotesUpdateWorkItems" is set to "true".
    Done building target "GetChangeSetsAndUpdateWorkItems" in project "TFSBuild.proj".

    The relevant portions of the TFSBuild.proj file:

    ...
    <Import Project="$(MSBuildExtensionsPath)\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets"/>
    ....
     <Target Name="AfterGet" Condition="'$(IsDesktopBuild)'!='true'">
        <!-- Set the AssemblyInfoFiles items dynamically -->
        <CreateItem Include="$(SolutionRoot)\**\$(AssemblyInfoSpec)">
          <Output ItemName="AssemblyInfoFiles" TaskParameter="Include" />
        </CreateItem>

        <Exec WorkingDirectory="$(SolutionRoot)"
              Command="$(TF) checkout /recursive $(AssemblyInfoSpec)"/>

        <Exec Command="attrib -R $(BuildDirectoryPath)\* /S" />
      </Target>

     

      <Target Name="AfterCompile">
        <RemoveDir Directories ="$(DropLocation)\$(BuildNumber)"/>
        <CreateProperty Value ="$(MaxAssemblyVersion)">
          <Output TaskParameter ="Value" PropertyName ="BuildNumber"/>
        </CreateProperty>

        <UpdateBuildNumberDropLocation             
          TeamFoundationServerUrl="$(TeamFoundationServerUrl)"             
          BuildUri="$(BuildUri)"             
          BuildNumber="$(BuildNumber)"             
          DropLocation="$(DropLocation)\$(BuildNumber)"
          />
        <Message Text="Build Uri set to &quot;$(BuildUri)&quot;" />
        <Message Text="Build number set to &quot;$(BuildNumber)&quot;" />   
       
        <Exec Command="&quot;$(VS2003_Devenv)&quot; &quot;$(VS2003_SolutionName)&quot; /build $(VS2003_Configuration)"/>
        <MakeDir
        Directories="$(BinariesRoot)\$(VS2003_Configuration)"
        Condition="!Exists('$(BinariesRoot)\$(VS2003_Configuration)')" />

        <Copy
        SourceFiles="@(VS2003_OutputFiles)"     
        DestinationFiles="@(VS2003_OutputFiles->'$(BinariesRoot)\$(VS2003_Configuration)\%(RecursiveDir)%(Filename)%(Extension)')"
        />

        <Exec
          WorkingDirectory="$(SolutionRoot)"
          Command="$(TF) checkin $(NoCICheckInComment)/comment:&quot;Auto-Build: Version Update&quot; /noprompt /override:&quot;Auto-Build: Version Update&quot; /recursive $(AssemblyInfoSpec)"
        />
       
      </Target>

      <Target Name="BeforeOnBuildBreak" Condition="'$(IsDesktopBuild)'!='true'">
        <Exec WorkingDirectory="$(SolutionRoot)"
              Command="$(TF) undo /noprompt /recursive $(AssemblyInfoSpec)"/>
      </Target>

Answers

  • Wednesday, October 21, 2009 8:15 AMHongye SunMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi HKWest,

    Welcome to MSDN forum.

    AssemblyInfo task has a limitation that it must be executed in compile time however label is created before compile. So they can't be synchronized. A workaround is to change to another tool. SDC task library has tasks which meet your need.
    You can download it at: http://sdctasks.codeplex.com/.
    Here is a walkthrough: http://www.tfsbuild.com/Default.aspx?Page=Increment%20Build%20Numbers%20(major,%20minor,%20build,%20etc)&AspxAutoDetectCookieSupport=1

    If my understanding is correct, the following issue should be same as yours: http://social.msdn.microsoft.com/Forums/en/msbuild/thread/d55df9eb-51de-4c27-a367-4b423a77e116

    Please let me know if it is not the case.
    Have a nice day.

     

    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Tuesday, October 27, 2009 12:03 PMHongye SunMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Sorry that the walkthrough is not complete and some steps are incorrect.

    Here is the corrected steps:

    1. Please check in all DLLs and task files in SDC Tasks into TFS: $\HostedBugbash\DbgBld2\BuildType\
    2. Move the version.xml to: $\HostedBugbash\DbgBld2\
    3. Add following content into version.xml file:
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <appSettings>
        <add key="major" value="1" />
        <add key="minor" value="1" />
        <add key="build" value="1" />
        <add key="revision" value="1" />
      </appSettings>
    </configuration>
    
    4. Change the all the places with $(MSBuildProjectDirectory)\version.xml to $(SolutionRoot)\version.xml.

    Hope it helps.

     

    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com





    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Wednesday, November 04, 2009 12:39 AMHKWest Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hello Hongye,

    Sorry for the delayed reply & thanks for your assistance in the matter. 

    Since the earlier attempt did not work, I reverted back to the AssemblyInfo Task for versioning the binaries of the build & a custom task that updates the Build Number.  That seems to work perfectly fine, and I am presently fine tuning the project file to iron out other kinks. 

    I will create a separate post -- but one thing that we will have to deal with in our build system is that we will effectively have thousands of builds before we release the product to market.  How does one go about archiving older builds?  At any given time, I don't want to have more than 10 builds available for the Found in field.

    Thanks for all your help!

All Replies

  • Tuesday, October 20, 2009 4:46 AMHKWest Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Any guidelines on how to resolve the above or feedback on what is incorrect or missing?  If this is not the right place to post this question, is there another appropriate forum for this? 

    Any pointers would be appreciated. 
  • Wednesday, October 21, 2009 8:15 AMHongye SunMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi HKWest,

    Welcome to MSDN forum.

    AssemblyInfo task has a limitation that it must be executed in compile time however label is created before compile. So they can't be synchronized. A workaround is to change to another tool. SDC task library has tasks which meet your need.
    You can download it at: http://sdctasks.codeplex.com/.
    Here is a walkthrough: http://www.tfsbuild.com/Default.aspx?Page=Increment%20Build%20Numbers%20(major,%20minor,%20build,%20etc)&AspxAutoDetectCookieSupport=1

    If my understanding is correct, the following issue should be same as yours: http://social.msdn.microsoft.com/Forums/en/msbuild/thread/d55df9eb-51de-4c27-a367-4b423a77e116

    Please let me know if it is not the case.
    Have a nice day.

     

    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Thursday, October 22, 2009 6:58 AMHKWest Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thank you for the welcome & the helpful feedback above.  I've dropped the AssemblyInfo Task & am now following the above guideline on www.tfsbuild.com.

    However, I am now seeing an error with "Unable to determine the workspace".  Any ideas on what might be wrong?  Appreciate any feedback.


    To answer your question, there is one difference from the above in my environment -- we are on TFS 2005 (not TFS 2008).

    I did not find CoreInitializeWorkSpace, and ended up substituting InitializeWorkspace in the following line:
    <Target Name="BuildNumberOverrideTarget" DependsOnTargets="InitializeWorkspace">

    Here is part of the build log:

     


    Project "D:\TFSBld\HostedBugbash\DbgBld2\BuildType\TFSBuild.proj" (EndToEndIteration target(s)):

    Target InitializeWorkspace:
        DeleteWorkspaceTask Name="BLDMACHINE2_HostedBugbash_DbgBld2" TeamFoundationServerUrl="http://MYTFSSERVER:8080/"
        CreateWorkspaceTask Name="BLDMACHINE2_HostedBugbash_DbgBld2" TeamFoundationServerUrl="http://MYTFSSERVER:8080/" MappingFile="WorkspaceMapping.xml" LocalPath="D:\TFSBld\HostedBugbash\DbgBld2\BuildType\..\Sources" TeamProject="HostedBugbash"
    Target BuildNumberOverrideTarget:
        Build path set to "D:\TFSBld\HostedBugbash\DbgBld2\BuildType\"
        "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\..\tf.exe" get /force /noprompt "D:\TFSBld\HostedBugbash\DbgBld2\BuildType\version.xml"
        Unable to determine the workspace.
        MSBUILD : warning MSB3073: The command ""C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\..\tf.exe" get /force /noprompt "D:\TFSBld\HostedBugbash\DbgBld2\BuildType\version.xml"" exited with code 100.
        The previous error was converted to a warning because the task was called with ContinueOnError=true.
        Build continuing because "ContinueOnError" on the task "Exec" is set to "true".

  • Friday, October 23, 2009 4:04 AMHKWest Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Figured out how to turn on verbose/detailed logging but still not getting any additional information that helps me get beyond the above workspace failure. 

    If someone has a sample tfsbuild.proj file for TFS 2005 that works, can you reply back or a link to a working example, that would be very helpful.

    Thanks!

  • Tuesday, October 27, 2009 12:03 PMHongye SunMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Sorry that the walkthrough is not complete and some steps are incorrect.

    Here is the corrected steps:

    1. Please check in all DLLs and task files in SDC Tasks into TFS: $\HostedBugbash\DbgBld2\BuildType\
    2. Move the version.xml to: $\HostedBugbash\DbgBld2\
    3. Add following content into version.xml file:
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <appSettings>
        <add key="major" value="1" />
        <add key="minor" value="1" />
        <add key="build" value="1" />
        <add key="revision" value="1" />
      </appSettings>
    </configuration>
    
    4. Change the all the places with $(MSBuildProjectDirectory)\version.xml to $(SolutionRoot)\version.xml.

    Hope it helps.

     

    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com





    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Saturday, October 31, 2009 3:41 AMHongye SunMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Is this issue resolved? Thanks.

    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Wednesday, November 04, 2009 12:39 AMHKWest Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hello Hongye,

    Sorry for the delayed reply & thanks for your assistance in the matter. 

    Since the earlier attempt did not work, I reverted back to the AssemblyInfo Task for versioning the binaries of the build & a custom task that updates the Build Number.  That seems to work perfectly fine, and I am presently fine tuning the project file to iron out other kinks. 

    I will create a separate post -- but one thing that we will have to deal with in our build system is that we will effectively have thousands of builds before we release the product to market.  How does one go about archiving older builds?  At any given time, I don't want to have more than 10 builds available for the Found in field.

    Thanks for all your help!
  • Wednesday, November 04, 2009 12:58 PMHongye SunMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for your reply. I have updated you in your new thread.

    Have a nice day.

     

    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.