Compilation Error: Team City and Visual Studio 2012 - tfs

So I have build project on TeamCity 8.0.3 and have create two build steps.
1.) The first step is to Install all NuGet packages.
I have set my project up according to this blog and if I run this step it works fine however I went over the logs and found: [14:07:45][install] All packages listed in packages.config are already installed. Is this OK?
2.) I have another step that is suppose to build my Class Library however I get a compilation error saying that references are missing even after step one, which is suppose to install the packages, has passed?
What am I doing wrong and should I provide more log details?

As already stated by Pedro, the first log message is absolutely normal.
For the second issue, it's not easy to throubleshoot a compilation error without logs :)
Often the issue is related to wrong checkout rules.
You can try to figure out what has been downloaded by teamcity by looking on the agent working directory (normally it is downloaded under c:\buildagent\work\'something', look at the build log to find out the actual folder).
Another common issue is that references are stored as absolute paths instead of relative paths: everything works on your machine, but teamcity builds on a different folder so referenced files can't be found... You have to open your csproj files with a text editor to find out if everything is ok.
Copy the entire folder on your machine and try to build it: are you able to reproduce the error?

Related

TFS Agent Build Reference errors

I am attempting to create my first ever agent build using on my my asp.net mvc projects. The agent is on my own computer. Everything appears to work fine up until after the nuget restore.
Picture:
It is telling me that my System.Web.MVC assembly could not be located. Since this is of course my first build I am unsure of what to do or what could cause this issue especially since it builds fine locally in VS.
Any help would be greatly appreciated:
TFS Version: 16.122.27102.1
You can follow steps below to locate the cause of the issue and resolve it:
1.The Nuget 4.3.0 you're using is too old. Instead you should use recommended 5.7.0. (Modify your Use Nuget Task)
2.Check log of your restore step.
The missing System.Web.MVC comes from Microsoft.AspNet.Mvc nuget package, so you should make sure this package is actually downloaded/installed. And make sure the hintPath in your csproj is correct compared to the installation path of the nuget package.
Also make sure you're restoring for whole solution instead of one specific project.
Check whether you added packages folder into source control. The packages folder in SolutionDir should not be added into source control! It will affect the restore stop.
3.Check MSBuild arguments of Build task, you can share the arguments and build logs here if convenient.

Unable to open resource file TFS 2015 build

I have been slowly attempting to get the TFS build to work. After some other fixes with other issues, I have gotten to the point where the build will throw the below error. Not exactly sure what to make of the error. I have double checked to make sure the Resources folder is in the solution. However, the file called "resources" is not, but there is a file named "resource". I know this is not much info to go on, however I am stumped at this point.
Suggest you first remote to the build agent machine and check if there are corresponding G3.Resources.resources under path G3.Resources.resources C:\agent\work\1\s
\G3DEV\obj\Debug\G3.Resources.resources
Double confirm the Mapping settings correctly and not cloaked some files.
Try to manually use VS or MSBuild command to build your solution directly on your build agent machine. This will narrow down if your issue is related to TFS build definition side or not.
You could also Enable Verbose Debug Mode for TFS Build vNext by add system.debug=true to get more detail log info for trobuleshooting.

TFS Build fails at NuGet restore

I have an on-prem 2017 install of TFS.
Other similar builds work just fine however this new build i have created fails at the first step - NuGet Restore.
The path set is: ***.sln
I will add that I created the new build by copying from another (working) build. There aren't many options to set in the task so I'm not sure what went wrong.
Attached is the result from the log page.
Any help appreciated.
thanks.
According to the error info
no matching files were found with search pattern: E:\vstsagent\_work\5\s\**\*.sln
Seems the build agent is lacking of the solution file.You could double check this on the build agent folder E:\vstsagent\_work\5\s\** to see if there are or not.
Please go through your repository mapping settings, mark sure including and not cloaked that .sln file.

TFS Build Script Definition - Not Getting Latest Code

For one of our build scripts (TFS 2013), when we run it manually or during Check-In (Continuous Integration trigger), the build script is not picking up the latest code changes. We looked in the logs and it does have the correct changeset number for the impacted files (in this case .vb files). We tried with several different .vb files. We also tried recreating the build script from scratch to no avail. We have several other build scripts for similar web applications that have no issues with the same build settings. This project builds fine. We set the Clean Build to True. Configurations is set to "Any CPU|Release". Output Location is set to SingleFolder. Build Template is set to TfvcTemplate.12.xaml. Any thoughts or suggestions would be appreciated.
So, after a bit of kicking the tires we figured it out. We had the actual compiled .dll in this case checked into TFS. Hence, the build server would grab the old version that was checked in versus compiling the project on the fly. We removed the .dll from source control to resolve the issue.

Creating an automated build fails due to a so called missing namespace

I am really new to TFS 2010 automated builds.
I am trying to setup an automated build for a project I am working on. Locally if I build the project it compiles as I expect it to without any errors.
If I trigger my build definition the build fails telling me that one of my .cs files is missing a namespace for a referenced project.
I have checked the reference and it's set to copy local, is there another reason why my build server doesn't think that the .dll is there?
Any pointers would be great!
My guess is that you are referencing a DLL that you have on your local machine, but that doesn't exist on the build server. My suggestion is looking at the build server build log and looking for any build warnings about unable to find references.
Chances are you need to add the DLL's to TFS and update the project references to reference the relative path in the source tree.

Resources