Automatically checking out TFS changes from one machine to another - visual-studio

I'm writing Protractor/Jasmine E2E tests on a local machine in Visual Studio 2015 which has my project stored through TFS and then I am running those tests each night on another machine. I may be misunderstanding the concept here and/or missing the point of the appropriate tool for this situation.
But, is there a way such that when I check in changes on my local machine that those changes are automatically checked out (get latest) on the secondary machine without having to manually get latest on the files?

If you deploy a build agent on the second machine, when you queue build, build agent will get latest version of your project into the source directory.
Or as #jessehouwing mentioned in comment, you can use TF.exe command line in a script on your second machine to get latest version of your project:
tf get /version:T

Related

project.assets.json not found - TFS Build Server, no internet

We're just in the process of transitioning from VS2013&15/TFS2013 to VS2017/TFS2017 (on-site TFS, not VSTS) and the first test solution is a dotNet Core 1.1 based one (a multi-project web service).
The solution builds fine on the original developer's box and I've got it out of TFS and it builds fine on mine too. In keeping with our previous methodology the contents of the packages folder are checked in with the projects as this makes the packages locally available on the build box (no internet).
Building the solution on the build server is a different story, however, as I get multiple errors of the form...
..\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
I get the errors both when I run the TFS build definition and when I remote to the box and build directly through the VS on the box itself.
This whole project.assets.json not found issue seems to be causing headaches all over. In my case the issue is that I'm trying to resolve it on our TFS 2017 Build Server, which does not and never will have internet access ('cos it's a server!).
All the solutions I've seen thus far seem to suggest running the Nuget Restore command but that can't work since the server cannot get to nuget.
This is nothing fancy yet, just a simple TFS 2017 Build definition with a Get sources and a Build solution step. I can't understand how something so simple has become so difficult.
Changing the Nuget Package Restore options makes no difference.
Since the project.assets.json files are generated on the fly in the obj folder, I can't even check them in to reuse. Can anyone please suggest a workaround, at the moment the test project is dead in the water.
Edit: trying the same process with a 4.6.1 web project created with VS2015 had similar results of unresolved references (e.g. System.Web) but didn't raise the same error, probably due to being an older, non-Core project.
According to I get the errors both when I run the TFS build definition and when I remote to the box and build directly through the VS on the box itself.
The issue seems not related to TFS build side since it also not work with local build through VS in the build agent machine.
Since this is a dotnet project. So, you could try to use “dotnet restore” and not “nuget restore”. Try using the dotnet core template (which uses dotnet restore).
If you are using authenticated nuget feeds, then you can use nuget restore but you also need to use nuget installer task. See https://github.com/Microsoft/vsts-tasks/issues/3762 for a discussion on that.
The Nuget version should be higher than 4.0.
Without dotnet restore and Nuget restore and only use get source/Visual Studio Build will not be able to build the dotnet core project. If your server do not have internet access, as a workaround you should use Local feeds.

TFS build runs with old code after checking in changes

Recently, I have been facing this issue where my TFS(2015 update 3) msbuild runs with old code even after checking in changes and saving changes locally in visual studio 2015 enterprise edition. I use build to run Automated UI test by running my machine as test agent.
I can see an agent workspace other than my workspace(don't know if anything to do with it).
Can anyone guide me to correct this issue, or anyway to move forward without facing this issue again?
Please try below items to narrow down the issue:
Check the source code via web portal, verify that the new changes are
really checked in.
Check the definition setting, try to set "Clean" to "True" in
Repository tab.
Also enable the "Clean" option in MSBuild step.
Try to create a new definition with the same settings, then try it
again.
Clean the caches for your TFS Application Tier and agent machine,
then try it again.
Reboot the TFS and agent machine
UPDATE:
Below screenshot for your reference, also make sure you mapped the source correctly. You can also try to delete workspace and entire source folder directly from your agent machine, eg C:\Agent\_work\2\s (You can get the info from build log)

Appname.deploy.cmd - The specified executable is not a valid application for this OS platform

I'm trying to set up automated deployment of my application via TFS using the web deploy package publishing method. I've successfully created the build artifact with the appname.zip deploy package in it and an appname.deploy.cmd (generated by visual studio) using a build definition.
However, when attempting to deploy it, it fails to run the cmd file with the error "The specified executable is not a valid application for this OS platform". I have no idea why this might be happening or what I might have missed, especially as this is my first time configuring a build/release definition in TFS. Both visual studio & TFS are 2015 and I'm trying to deploy an ASP .NET application.
The release definition steps are:
1- Copy files from $(System.DefaultWorkingDirectory)/ to F:\WebDeployPackage (runs ok)
2- Run PowerShell F:\WebDeployPackage\App\drop\AppName\obj\Release\appname.deploy.cmd /Y "-setParam:name='IIS Web Application Name',value='AppName'" (Error)
I've checked that the file path is correct & it is present in the same path in the artifacts after the corresponding build. I've also searched for this error but it seems to be very case-specific and I couldn't relate any other answer/google results to my case.
I am not sure if the issue is in my target server or in my release definition or elsewhere, any help appreciated.
I have tested a similar release and worked as expected. So there is nothing wrong with your script or argument:
Maybe the issue is related to deployment environment. You need to go the machine that you want to deploy to and run the powershell command manually ob this machine to see whether it works. Also, you may try deploying to another machine to see whether it works.

How to get output in team build in TFS

I started learning TFS Team build. I am having a basic doubt. I referred this
article. I followed the steps exactly and got succeeded. I created a Console Application and pushed in TFS using TeamServices. My doubt is when we build a Console application in visual studio we will get an exe in bin folder.
Same way in this team build how to get the output in my local machine ?
What is the difference between the local build using Visual studio and this team build ?
EDIT :
I added like this. Still I am not able to see the output in the RELEASE folder.
I got the result as success saying
Still I couldn't figure out the output - the exe produced as a result of build.
Am I doing anything wrong ?
Note : I have a requirement like what you explained in the answer. So why I am using TFS team build. Since I am new I am experimenting with a small example.
When to use a build system
Team Build does not replace Visual Studio build. Use Team Build when you have a complex / lengthy build, to easily integrate running unit tests as part of the build or to deploy assemblies to a server after the build is complete.
Most people will setup a TFS build definition to run as "Continous Integration" build, meaning that whenever a commit is checked in, a build occurs. The build would compile and run tests and if it fails all developers can be notified.
How to get to the build output
When using a build system like TFS build, the build is done on a remote machine. If you want to retrieve the output of the build, add a Publish Build Artifacts step to your build definition. Since the build happened on a remote machine, the remote machine does not have access to your local developer machine.
The artifacts (assemblies) will be available for download on the build summary page:

The virtual path ... maps to another application, which is not allowed. Team Foundation Server build fails

I have a WebSite project that builds successfully when running locally. I'm trying to setup Continuous Builds for this website in TFS (Visual Studio 2010) - when the build runs, it's failing with this error -
The virtual path '/abc/MasterPages/abc.master' maps to another application, which is not allowed.
Within my build agent, I'm not even trying to publish this to IIS - all I've configured it to do is to just run the build and copy the output to a specific folder.
Can anyone please let me know how I can get around this problem in TFS, as the same code runs successfully on all the developers' workstations?
Do you have publish information set as part of the project? If so remove it. Publish step needs to be done another way as part of a tfs build
Work around was to Prefix ~ in all relative URLs - for eg: '/abc/MasterPages/abc.master' will be '~/abc/MasterPages/abc.master'
That seemed to solve my problem.

Resources