TFS does not build projects correctly - tfs

HI
I am trying to build my solution using TFS but it seems to skips the projects which have dependencies.
e.g Proj B depends on Proj A , then it builds only Proj A and not Proj B.
Also if i try to build the projects individually instead of the solution then it does not create the release folder. It says that the output path is not found.
Any help is much appreciated
thanks

Is the SLN file in question converted from an older version of Visual Studio?
I've found that sometimes, like when you upgrade from a VS2003 SLN file to a VS2008 SLN file, it fails in MSBuild (which is what TFS is doing essentially).
Try making a new SLN file in VS2008 (or whatever version you're using) with the same project and see if that fixes it...

If you right-click the solution, one option you'll have is dependencies. Make sure that the projects are correctly setup there, even though they may reference each other the dependencies on the solution itself may not be complete or accurate...and this is what MSBuild uses.

Have a look in the configuration manager and make sure that the build you are running has those projects selected to build.
It may be you are running the Debug configuration for your local build and then running Release on the TFS server and it's not configured the same.

Related

Nuget Restore in MS Build Step

In my asp.net web application, i have solution with 5 projects and nuget.org. In TFS Build Definition,
1) While building the whole solution in Visual Studio Build Task
Nuget packages getting restored.
2) While trying to generate executable files for individual projects in MS Build Task
If I select Restore Nuget packages, It's not finding nuget packages and step getting failed with message - "Process 'NuGet.exe' exited with code '1'."
I have tried many references online and none worked. Any suggestions on how to solve this?
Do i need to make any changes in the nuget.config file to support restoring
packages to individual projects.
Do not directly select Restore Nuget pacakges in MS build task configuration. This option is deprecated. To restore NuGet packages, add a NuGet Installer step before the build.
(Important) This option is deprecated. Make sure to clear this
checkbox and instead use the NuGet Installer build step.
Source Link: MSBuild
Besides, you could also build single project not the entire solution in Visual Studio Build task. Just select the project (.*proj) files instead of .sln file.
Unless you are building a customized MSBuild project file, then we recommend you use the MSBuild step instead of the Visual Studio Build step.
You could also try to build single project using Visual Studio Build task, see if the issue is still exists.
Same problem, downgraded to 4.4.1. it helped

References don't show up in Visual Studio 2017 after creating a .NET Standard branch

I'm working with Visual Studio 2017 on the open-source project https://github.com/SpiegelSoft/XamarinForms.Reactive.FSharp
I recently created a branch called dotnet-standard, which, as its name suggests, is a migration to .NET Standard. However, after creating this branch and checking back in to the master branch, which is a PCL rather than a .NET standard library, the project will no longer build.
First of all, the references are not visible. All I can see in Visual Studio is a .NET node (see screenshot).
The build fails in the first instance with
Xamarin.Forms targets have been imported multiple times. Please check your project file and remove the duplicate import(s).
This is odd because the same fsproj file was working before I created the new branch.
When I delete the Xamarin.Forms import line in my fsproj file and then perform a git reset --hard, the error message changes to
Your project is not referencing the ".NETPortable,Version=v4.5,Profile=Profile259" framework. Add a reference to ".NETPortable,Version=v4.5,Profile=Profile259" in the "frameworks" section of your project.json, and then re-run NuGet restore.
But the IDE won't even let me a a project.json file. Something has clearly gone very wrong with my Visual Studio settings.
Does anyone have any obvious tips before I reinstall Visual Studio?
As alluded in the comments, VS / MS Build can trip up on previously generated files - often in the various obj folders.
To get back to a ‘clean’ state (the same as when you first clone a repo), run git reset —hard to revert any uncommitted changes and git clean -xfd to remove any untracked files and folders.
Assuming your .gitignore file is configured correctly, this last step should remove all temporary files.

TFS Build with PostSharp Debug | Any CPU

I have a .Net project (framework 4.0) that references PostSharp assembly (version 2.1). The project is configured for Debug and Release with Any CPU.
I'm trying to build that project on TFS (2012), created a build definition where I add two workspaces:
- One workspace with the directory where is the PostSharp.dll assembly
- One workspace where the .csproj file is.
The configuration I added is Debug | Any CPU.
When I attempt to build, it states that everything works fine but warns that my project doesn't have an OutputPath configured. After googling, I found out that it was related with the Any CPU, that should be AnyCPU without the space.
But if I do this, when TFS attempts to build my project it states that The type or namespace name "PostSharp" could not be found.
So if I use Any CPU TFS seems to recognize PostSharp, but if I use AnyCPU seems to recognize my project but not PostSharp.
Is there any workaround for this?
Thank you.
In the meantime I found the answer, it was the Build agent folder for my PostSharp assembly directory that was wrong. Works fine now.

Error: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was not found

I have migrated a VS2008 solution to VS2013. My solution contains VC++ projets.
I have set the tools platform to v120_xp for each project
My solution compile on my computer and compile on my builds server in VS2013
My builds server is a Windows2008 R2 with VS2008, VS2010 and VS2013 and a build controler of TeamFoundationServer 2010.
When i launch the build with the build controller, the build fails with :
The imported project "C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was
not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
In the V110 directory this file doesn't exist but it exist in the V120 directory.
I have checked the registry :
HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersion\12.0
the VCTargetPath are corrects
Have you an idea to help me?
I have edited the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\12.0\11.0
and
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0\11.0
to use the V120 directory
Now my server build the solution, but i don't understand why MSBuild use the key
ToolsVersions\12.0\11.0 and not the key ToolsVersions\12.0\12.0
Parhaps it's due to the v120_xp platform toolset
The true answer is that MSBuild subtracts 1 from the .sln Visual Studio Version. Since you do not have VS 2012 install or you have not installed it, the v11.0 folder is not found. It is all explained by Sayed Ibrahim Hashimi:
http://sedodream.com/PermaLink%2cguid%2ca5894bad-f2a1-441a-a5b2-74f16c6cf8aa.aspx
I came across the same problem in 2015 though, with Windows 10 and Visual Studio 2015 RC (fresh install)
To correct the issue I tried several solutions based on my research ie installing "VS Windows SDK" which didn't do anything different to resolve my problem, I then on another recommendation installed GitHub in order to download MSBuild which is now excluded from VS, I ultimately downloaded and installed "VS Tools for Windows 10" this didn't give me the same error in the end, without having to change registry keys
Installing VS 2012 on your build server should create the necessary targets files for you.
I was able to get past this by changing $(VCTargetsPath) to $(VCTargetsPath12) in the project file.
This feels like a temporary workaround rather than a permanent solution, since once we move to the next version of Visual Studio we'll have to find all the references to $(VCTargetsPath12) and replace with the new target path.

TFS 2012 build exclude some project from compilation process

I have some strange behavior in my automatic build. When I open solution properties in build workspace I find that there is one project not checked in configuration to build, and my build fails. When I open this solution from TFS source control, this project is checked and build in VS pass successfully. Does anyone have an idea of what can exclude the project from solution configuration in build process? Could there be any other reason for this problem?
Check out if the project is included in the Configuration Manager window (solution context menu), for the given flavor (Release/Debug) and CPU. TFS build is probably using another configuration.

Resources