Visual Studio Team Services build is unable to find a library - tfs

​I am trying to use Team Services CI Build, but it keeps on failing with the same error:
##[error]MobileClient\LoginNavigation\CommentPage.xaml.cs(1,7): Error CS0246: The type or namespace name 'Android' could not be found (are you missing a using directive or an assembly reference?)
Which seems to be right, since in a previous step it is complaining about not finding that library:
##[warning]C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "Mono.Android". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Also, it is logged where the build is searching it:
For SearchPath "{HintPathFromItem}".
Considered "..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll", but it d idn't exist.For SearchPath "{TargetFrameworkDirectory}".
For SearchPath "{TargetFrameworkDirectory}".
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259\Mono.Android.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259\Mono.Android.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259\Mono.Android.exe", but it didn't exist.
For SearchPath "{RawFileName}".
Considered treating "Mono.Android" as a file name, but it didn't exist.
To my understanding, this file is missing in the Team Services build server, right? How could I solve this? Should it be necessary to change this directory?
One important thing is that locally, in my machine, the Visual Studio and the command line MSBuild are working correctly.
This happens during the Visual Studio Build step, which has the following configuration:
MSBuild Configuration: MSBuild ​x86
Visual Studio Version: Visual Studio 2015
MSBuild Arguments: /p:DeployOnBuild=true /p:WebPublishMethod=Package
/p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true
/p:PackageLocation="$(build.artifactstagingdirectory)\"
Visual Studio Build Solution step version: 1.*
Here are the steps of the Team Services build:
​
​​

Ok so after reading the answers and suggestions I received, I got a hint of what I had to do to resolve this. Basically, I was making two mistakes:
First of all, on the project that was failing, I changed the Mono.Android reference to one inside the project's folder. Even though that error disappeared, I kept on having more and more errors related to Xamarin and Android.
So that's when I followed another suggestion in this thread: using a Xamarin.Android template. The thing is, that in this project I have a .sln file, which contains different type of projects, including a Xamarin project, a Web Api, and some Class Libraries. I was trying to build them all in the same Team Services build definition, but I realized it was much more efficient to have different definitions according to the different type of projects.
In consequence, I ended up having a build definition for the Xamarin project, using the Xamarin.Android template, and another one for a .sln file I created with all the projects used by the Web Api project. The amount of errors was reduced drastically, and I felt I wasn't "swimming against the tide" anymore.
I would suggest everyone having a solution with a wide variety of project types to do the same.

Related

F# broken in VS build tools 2019 16.6.0

After installing this version, nothing that touches F# will build, everything throws the same exception:
error FS0193: Could not load file or assembly System.Buffers, Version=4.0.3.0, blablabla..
Apparently it's nothing to do with what I'm building. Even trying to execute let x = 3 in fsi.exe has the same problem.
Anyone else had this problem?
Yes, this is a known problem, see https://github.com/dotnet/fsharp/issues/9295.
While the next fix isn't out yet, you can resolve it by manually copying the missing assemblies. The exact list of missing assemblies is mentioned in this comment. The cause was explained by Kevin Ransom to be that the Setup for MSBuild didn't get the new dependencies for fsc.exe.
Note that FSI from within Visual Studio shouldn't have this issue, nor should building from within Visual Studio 2019. The way I understand it, only the MSBuild Tools are affected.
For posterity, in case the links go dead, the workaround in the Github issue is to just copy the dlls over:
copy "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\PublicAssemblies\*.dll" "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\FSharp"
Edit: the source path given above may not always be correct, depending on what versions of VS you've installed. Alternatively, try:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\PublicAssemblies
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\PublicAssemblies
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\PublicAssemblies
If you only want to copy the minimal set that's needed, just copy only these files, that's the diff set:
System.Buffers.dll
System.Memory.dll
System.Numerics.Vectors.dll
System.Reflection.Metadata.dll
System.Resources.Extensions.dll
System.Runtime.CompilerServices.Unsafe.dll
System.Threading.Tasks.Dataflow.dll

TFS Build not finding Dlls

I am new to TFS build. I am using TFS Visual Studio Template.
My app uses dev express dlls.
All my devexpress dlls are checked into Common Folder:
When I run the build, build agent is failing with unable to find dev express component. Its looking for dlls under : C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1
2017-05-23T19:15:04.0271172Z For SearchPath "{TargetFrameworkDirectory}".
2017-05-23T19:15:04.0271172Z Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\DevExpress.Charts.v15.2.Core.winmd", but it didn't exist.
2017-05-23T19:15:04.0271172Z Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\DevExpress.Charts.v15.2.Core.dll", but it didn't exist.
2017-05-23T19:15:04.0271172Z Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\DevExpress.Charts.v15.2.Core.exe", but it didn't exist.
2017-05-23T19:15:04.0427439Z Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\DevExpress.Charts.v15.2.Core.winmd", but it didn't exist.
2017-05-23T19:15:04.0427439Z Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\DevExpress.Charts.v15.2.Core.dll", but it didn't exist.
2017-05-23T19:15:04.0427439Z Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\DevExpress.Charts.v15.2.Core.exe", but it didn't exist.
2017-05-23T19:15:03.7771166Z 7>ResolveAssemblyReferences:
2017-05-23T19:15:04.0271172Z Primary reference "DevExpress.Charts.v15.2.Core, Version=15.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a".
2017-05-23T19:15:04.0271172Z ##[warning]C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "DevExpress.Charts.v15.2.Core, Version=15.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
2017-05-23T19:15:04.0271172Z 7>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DevExpress.Charts.v15.2.Core, Version=15.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [E:\agent\CentralCompliance\_work\9\s\CentralCompliance\CentralCompliance.csproj]
2017-05-23T19:15:04.0271172Z For SearchPath "{CandidateAssemblyFiles}".
Any idea why its not looking into the common folder? What am I doing wrong?
Thanks for help.
Due to the VS designer specificity, all designer assemblies should be installed in the GAC. Guess this is why it's looking for dlls under:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1 instead of your common folder. It's not possible to deploy those assemblies to computers without DevExpress installation. So does the build agent. The design assemblies which will be put into the GAC during the DevExpress installation.
Besides to avoid the license issue, you should also need to install the DevExpress on build agent.
We are verifying and integrating the license information at the
"building an application" stage. So, it's necessary to have our
components installed and registered on a machine. Otherwise, the
trial window may appear. You can organize a build server and build
projects there. The build server should have the components
installed as well, however, you can be sure that you will not get a
licensing issue.
More details please take a look at below link:
Is it possible to keep DevExpress dlls in TFS
Add DevExpress libraries to TFS source control
You have to install DevExpress on your build agent. The build process restores the dependencies by using a local DevExpress installation.

Build failure - Restore package option not working in Visual Studio Team Services (was VS Online)

I am using a TFS Git project in Team Services and while my project compiles locally, I get a build failure when I check in my code to VS online and manually queue the build.
The errors at the moment are only pertaining to enterprise library data access dlls. I am using V6 of the library and this is error I get
The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
In my build definition I have checked the box against both Restore Nuget Packages and when that alone did not work, I checked the box against [Clean] as well. I still get that error. My packages.config files are checked in for each of the projects in the solution. I also have the Packages folder checked in but this folder has no dlls. It only has the various .nupkg files and respective .xml files checked in. Is this causing the problem?
Yes, you have to either checkin the DLLs or delete the nupkg files. The build server thinks you already have the packages so its not trying to restore them but the DLLs aren't there to reference.

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.

Resources