Reputation: 871
We created a build template that accepts the path of a powerscript filename as an argument. Right now it works if I type in the actual path of the script. I would like to pass $(SourceDir) as part of the path, and then replace it with the actual value during the build.
For example: $(SourceDir)\myapp\scripts\scripttorun.ps
Here are the steps that I have done:
Upvotes: 0
Views: 1310
Reputation: 51183
Possibly duplicate with this case TFS How to GetEnvironmentVariable value. You can't use $TF_BUILD_BUILDDIRECTORY in a custom build process.
Refer to the last paragraph in this MSDN document:
Use environment data from a custom build process
If you need to use an environment variable in your custom build process template, you can use the
GetEnvironmentVariable
activity to get the data. You can get data from any of the WellKnownEnvironmentVariables.For example, to get the path to the binaries directory, set the Name property of the
GetEnvironmentVariable
activity toMicrosoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BinariesDirectory
Please refer more detailed info about how to use it from this blog Using Environment Variables in Visual Studio 2013 and TFS 2013
Upvotes: 1