简体   繁体   中英

Visual Studio 2015 - Finding out path to currently used workspace (C# / custom build steps)

I would like to add a custom build step to copy the executable from where it was built (in current active configuration, in current workspace, by currently logged in user) into a shared location. Are there any predefined environment variables in VS (?) that would contain that information? Or C# API to Visual Studio that would provide the same?

This might help: https://msdn.microsoft.com/en-us/library/42x5kfw4.aspx

These did not help: Visual Studio 2015 Extension - How to get workspace of current Solution

How to get the TFS workspace directory

VNext build

Seems you want to copy files from working folder on the agent computer.( The local path on the agent where your source code files are downloaded. For example: c:\\agent\\_work\\1\\s )

You can try to use Windows Machine File Copy task.

Source: You can use pre-defined system variables such as $(Build.Repository.LocalPath) (the working folder on the agent computer), which makes it easy to specify the location of the build artifacts on the computer that hosts the automation agent.

Destination Folder: The folder on the Windows machine(s) to which the files will be copied. Example: C:\\FabrikamFibre\\Web

If your shared loaction is on the same machine. You can also try to use Copy Files .

XAML build

In XAML build, you can check in your script, and specify a post-build script path in your XAML build definition. This script gathers some of the typical binary types from the typical locations and copies them to the folder from which TFBuild copies and drops to your staging location . Check more information about Run a script in your XAML build process at website: https://msdn.microsoft.com/library/dn376353%28v=vs.120%29.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM