Answered Environment Variables were not found

  • Friday, July 06, 2012 7:50 AM
     
     

    Hi,

    In my solution, during the Post Build Event, will copy a set of files.

    The destination of the file copy is a Environment Variable - PROTEC_DEV_DIR W:

    This drive is created by using this command

    subst w: d:/data

    If I build using the Visual Studio 2008, everything goes well.

    However, using Team Build of Team Foundation Server 2008, the build will report an error, of not able to find the environment variable.

    See picture below.

    Error Log + Env Var settings

    Can anyone advice on how to over come this?

    Thank you.

All Replies

  • Friday, July 06, 2012 12:45 PM
     
     Answered

    Hi,

    You have to consider following things.

    1. Environment Variable is defined on the Build Server / Build Agent computer.

    2. User account under which build services are running should have access to this environment variable. If it's defined System Environment Variable then everybody on that machine will have access to it otherwise you will have to add it into the User Environment Variable for the user running Build Agent Services.

    3. After creating Environment Variable, you should re-start Build Agent Services. This way it will recognize new environment variables.

    4. Login to the Build Agent as the user under which account your builds are running and then from the command prompt just run "SET" command and you will see list of all the environment variable that are defined for that user.

    Hope one of this will help you to resolve this issue.

    Best Regards,

    Dharmesh Shah.

  • Friday, July 06, 2012 1:04 PM
     
     Answered

    When you set a system environment variable you will need to restart the build agent service for it to pick up the new variable.

    Patrick