Reputation: 9308
I’m setting up an automated build in VSTS that will FTP the published files to my server.
I have this working but the way I’ve achieved it, I feel is hacky and non-sustainable.
the process as you can see from the screenshots will publish the artefact which consists of a readme, cmd file and a zip containing all my publish files and then I extract the ZIP with the very explicit location below.
$(Build.ArtifactStagingDirectory)\temp\Content\d_C\a\1\s\IntermittentBug\IntermittentBug\obj\Release_EukHosts\Package\PackageTmp
I’m using a hosted build server in VSTS but as the path contains
d_C\a\1\s\
I assume this will change in time. What I need is a variable to cater for this path so it will always succeed.
How can I update this to make it more efficient and sustainable?
Upvotes: 3
Views: 723
Reputation: 33738
First, as jessehouwing said that the variable is called Build.SourcesDirectory
.
Regarding the path structure, the simple way is specifying /p:PackageTempRootDir=""
msbuild argument in Visual Studio Build task to remove the source path structure, then the path will be like Content\D_C\PackageTmp
.
On the other hand, you also can publish the web app through File System mode.
Upvotes: 3
Reputation: 115037
This variable is caught in a predefined variable called Build.SourcesDirectory
. see the complete list of predefined variables here.
In your batch or powershell scripts this variable is available as a environment variable called %BUILD_SOURCESDIRECTORY%
/ $env:BUILD_SOURCESDIRECTORY
.
Upvotes: 2