So, I'm coding a chat, and I'm testing it over 2 computer, I've setup a box folder so when I drop the builded.exe in it the other computer have it available.
My question is : is there anyway to put it automatically in a specified folder every time I build the program?
Use a post build script. This is just a Windows batch (aka. command) script. You can easily set it to copy from the output folder (VS adds macros so that does not need to be hardcoded) to wherever you can access.
As others mentioned you can use post build event for that. You can use something like below in the post build event to copy the build output to the location you want.
copy $(TargetPath) "c:\Output"
Related
In item's properties there is Copy to Output Directory option which copies a file after build. However the files I want to copy to output are very often data that can be reloaded by the program dynamically at runtime so I would like to be able to replace them on every save during debugging, while still keeping them in solution explorer.
What is the easiest way to do this?
I imagine few option
Some existing VS extension can do this, ideal
Write new extension, which will probably need some extensive research for me. Can't estimate time needed to do this
Write some simple external program, which will be annoying to setup in long run
I have a sample extension for Visual Commander demonstrating how to hook the save event in Visual Studio: Run Cppcheck on the saved file.
So, you just need to add a filter condition to the OnDocumentSaved method and copy the saved file to the output directory.
Is there a generic way I could write a post-build event in VS 2017 to copy all satellite assembly folders to another directory? Each folder contains a library named [assemblyname].resources.dll
I have 8 different configurations, all have the same set of these folders (the number of cultures will increase over time). This is why I'd prefer a generic way over hard-coding every file in the post-build macro.
PS: As I wrote this I figured out I could write a separate app to do this, but maybe still there is a way to code it inside post-build event?
You can use XCOPY command in post-build script.
TFS 2013 using the DefaultTemplate11.1.xaml.
Inside the BeforeCompile Target.
I'm trying to copy files in my .proj file to the droplocation but the variable, $(TF_BUILD_DROPLOCATION) does not seem to work.
I've tried evaluation it from inside the .proj but it with $(TF_BUILD_DROPLOCATION) but it evaluated to empty.
I've tried passing it in as a parameter from the msbuild arguments with DropLocation=$(TF_BUILD_DROPLOCATION); but it doesnt evaluate and appears in the script as $(TF_BUILD_DROPLOCATION).
The drop location should be our share with the build number appended.
I don't think it is possible to use the TF_BUILD_DROPLOCATION variable in the .proj file.
For your requirement to copy files to TFS build drop location, here are some options:
Just as Dave mentioned above, you can first use Copy task to copy files to one specific folder, then customize the TFS build process template via adding the CopyDirectory build activity to copy contents in source folder to destination folder. You can set the Destination to be: Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.DropLocation
Customize your build process template via adding InvokeProcess activity to call xcopy command to copy files. Please check Ewald's blog. (The blog was written for TFS2010, it applies to TFS2013 as well)
I should have been more specific. We're working with VSO, hence the process can not be edited.
So the answer is no, the drop location is not available.
I've had to construct the droplocation myself using $(MyDropLocationRootParam)\$(BuildDefinition)\$(BuildNumber)
I would like to create a Build Definition inside TFS 2012 Express which will simply copy all files within my project source tree to another folder on my drive. Just to underline - I do not want the build output to go to another directory - I want the source files themselves to. The reason for this is I have IIS pointed at a specific folder, and I want the build to copy the latest asp and aspx files to the IIS hosted folder.
I am not sure of the intricacies of doing this, I did find : http://toadcode.blogspot.co.uk/2008/06/copy-multiple-files-via-tfs-build.html articles like this but I simply need a more direct list of what I need to do from somebody who understands this area.
Basically - when the build is queued, all I want is to copy my project source files to another directory :). I think this can be done by editing some Build.xml file...but when making a build definition I dont seem to be given the freedom to do what I would like to!
I think what I am looking for to alter my DefaultTemplate.11.1.xaml file to alter the build process which will let me run this / or a batch file after the build process completes?
My TFS build process edit screen looks like this:
Using this post as a guide on how to start editing TFS Build Templates (or the Wrox TFS 2012 book), you need to make the following changes:
Locate the Copy to Drop Folder Activity:
Drag in a "CopyDirectory" activity under the "Drop Files to Drop Location" (from the Toolbox under Team Foundation Build Activities):
Goto the Properties Window for the new Activity and set Source and Destination as follows:
Destination: Path.Combine(BuildDetail.DropLocation, "MyOutputFolder")
Source: Path.Combine(SourcesDirectory, "MyFileFolder")
You may need to repeat this if you don't have all your files in one folder.
I actually put something together for TFS2010 and 2013 (not 2012, unfortunately) a few weeks ago that does exactly that. Basically, anything in the workspace you define for your build just gets shoved over to the drop location.
Here's a link to the blog post where you can download them:
http://www.incyclesoftware.com/2014/06/deploying-uncompiled-resources-release-management/
For the record, I strongly recommend against using a build process template to deploy software. Don't try to overextend the build... its job is taking stuff from source control and compiling/packaging it for deployment. Use a real release management solution to actually handle deploying software.
Add a bat file to your source folder. within the batch file add an xcopy %1*.* TargetLocation.
Add an invoke process activity to your workflow, somewhere near the end. call the bat file and pass it the SourcesDirectory.
I think its a rather simple question but I couldn't really find an answer for it so I will ask it in case someone else might need it .
There are developers who in-order to copy all projects to bin folder set the bin folder path using the project output path property and there are developers who use the xcopy command in post build event.
What are the main reasons for it ?
Regards ,
James Roeiter
I think setting project output path is a better option. The reason is that in this case Visual Studio is in control: it takes care of cleaning up, replacing older files, deciding which files to copy... When using xcopy, Visual Studio just invokes blindly a batch file. It will run all the commands on the batch which will result in files being copied whether they were compiled or not. Also, if the compilation order of projects changes, or new projects are added or removed, the corresponding post-build actions need to be updated, resulting in extra steps.