question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not set /m parameter for MSBuild by default

See original GitHub issue

What You Are Seeing?

Xamarin based projects are not compiling correctly. Either SDK files are not found or Android packages are not downloading correctly on a clean build server with minimal build tools installed.

Note: This works perfectly if I execute msbuild manually on exact same system

error

and

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(387,2): error XA5207: Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. Java library file C:\Users\build\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.3.0.0\embedded\classes.jar doesn't exist. [E:\Builds\GitHub\Xamarin-Forms-Labs\src\Forms\XLabs.Forms.Droid\XLabs.Forms.Droid.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(387,2): error XA5207: Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. Java library file C:\Users\build\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.3.0.0\embedded\libs/internal_impl-23.3.0.jar doesn't exist. [E:\Builds\GitHub\Xamarin-Forms-Labs\src\Forms\XLabs.Forms.Droid\XLabs.Forms.Droid.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(387,2): error XA5206: Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. Android resource directory C:\Users\build\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.3.0.0\embedded\./ doesn't exist. [E:\Builds\GitHub\Xamarin-Forms-Labs\src\Forms\XLabs.Forms.Droid\XLabs.Forms.Droid.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(387,2): error XA5207: Please install package: 'Xamarin.Android.Support.v7.CardView' available in SDK installer. Java library file C:\Users\build\AppData\Local\Xamarin\Xamarin.Android.Support.v7.CardView\23.3.0.0\embedded\classes.jar doesn't exist. [E:\Builds\GitHub\Xamarin-Forms-Labs\src\Forms\XLabs.Forms.Droid\XLabs.Forms.Droid.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(387,2): error XA5206: Please install package: 'Xamarin.Android.Support.v7.CardView' available in SDK installer. Android resource directory C:\Users\build\AppData\Local\Xamarin\Xamarin.Android.Support.v7.CardView\23.3.0.0\embedded\./ doesn't exist. [E:\Builds\GitHub\Xamarin-Forms-Labs\src\Forms\XLabs.Forms.Droid\XLabs.Forms.Droid.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(387,2): error XA5207: Please install package: 'Xamarin.Android.Support.v7.RecyclerView' available in SDK installer. Java library file C:\Users\build\AppData\Local\Xamarin\Xamarin.Android.Support.v7.RecyclerView\23.3.0.0\embedded\classes.jar doesn't exist. [E:\Builds\GitHub\Xamarin-Forms-Labs\src\Forms\XLabs.Forms.Droid\XLabs.Forms.Droid.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(387,2): error XA5206: Please install package: 'Xamarin.Android.Support.v7.RecyclerView' available in SDK installer. Android resource directory C:\Users\build\AppData\Local\Xamarin\Xamarin.Android.Support.v7.RecyclerView\23.3.0.0\embedded\./ doesn't exist. [E:\Builds\GitHub\Xamarin-Forms-Labs\src\Forms\XLabs.Forms.Droid\XLabs.Forms.Droid.csproj]

I have also replicated this on both a Windows 10 (Build 1511 base) and a Windows 2016 Tap 5 build server.

It seems that there is something that cake is doing when it executes msbuild that is resulting in the error.

What is Expected?

Build should work as expected. if I run msbuild manually it works 100% of the time on a clean system

What version of Cake are you using?

Tried

  • Version 0.13.0+Branch.main.Sha.f7346f2a5fb4e19a24cf15780ce635529f921be4
  • Are you running on a 32 or 64 bit system?

    64

What environment are you running on? Windows? Linux? Mac?

  • Windows 2012R2
  • Windows 10 (based on 1511)
  • Windows 2015 Tap 5

Are you running on a CI Server? If so, which one?

  • Standalone and appveyor (both have same issue)

https://ci.appveyor.com/project/xlabs/xamarin-forms-labs-hva8p/build/2.3.0.3.master

How Did You Get This To Happen? (Steps to Reproduce)

Test 1 Windows 2012 R2

  • Setup
    • Windows Updates as of 7/21/2016
    • Install Chocolatey
    • Install 7zip
    • Install Visual Studio 2015 Enterprise w/Update 3 (full install all components except emulators and lightspeed)
  • Build Process
    • Clone repository
    • Execute .\build.ps1 -Target Package
    • Result Fails
    • Immediately execute .\build.ps1 -Target Package (which does a full clean)
    • Result Succeeds

Test 2 Windows 2012 R2

  • Setup
    • Windows Updates as of 7/21/2016
    • Install Chocolatey
    • Install 7zip
    • Install Visual Studio 2015 Enterprise w/Update 3 (full install all components except emulators and lightspeed)
    • Install Xamarin Tools (from Xamarin.com) with defaults (see screenshots below)
  • Build Process
    • Clone repository
    • Execute .\build.ps1 -Target Package
    • Result Fails

!(AndroidSDKInstall)[https://i.imgur.com/T76dTVv.png] !(MissingComponents)[https://i.imgur.com/fkWOYAx.png]

Test 3 Windows 2012 R2

  • Setup
    • Windows Updates as of 7/21/2016
    • Install Chocolatey
    • Install 7zip
    • Install Visual Studio 2015 Enterprise w/Update 3 (full install all components except emulators and lightspeed)
    • Install Xamarin Tools (from Xamarin.com) with defaults (see screenshots below)
  • Build Process
    • Clone repository
    • Execute …nuget\nuget restore .\src\XLabs.sln -ConfigFile …nuget\nuget.config
    • Execute msbuild /m /v:normal /p:Configuration=“Release” /p:Platform=“Any CPU” /p:TreatWarningsAsErrors=False /target:Build "E:/Builds/GitHub/Xamarin-Forms-Labs/src/XLabs.sln
    • Result Fails

Test 4 Windows 2012 R2

  • Setup
    • Windows Updates as of 7/21/2016
    • Install Chocolatey
    • Install 7zip
    • Install Visual Studio 2015 Enterprise w/Update 3 (full install all components except emulators and lightspeed)
    • Install Xamarin Tools (from Xamarin.com) with defaults (see screenshots below)
  • Build Process
    • Clone repository
    • Execute …nuget\nuget restore .\src\XLabs.sln -ConfigFile …nuget\nuget.config
    • Execute msbuild /v:normal /p:Configuration=“Release” /p:Platform=“Any CPU” /p:TreatWarningsAsErrors=False /target:Build "E:/Builds/GitHub/Xamarin-Forms-Labs/src/XLabs.sln
    • Result Sucess

The issue seems to be related to the /m property

Link to GitHub Repository

Output Log

cakebuild-20160723-0706.txt

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
ravensorbcommented, Jul 23, 2016

@gep13 not sure yet – still testing. That will be one of the tests I run and I’ll let you know what the result it.

0reactions
ravensorbcommented, Jul 23, 2016

Using the following

MSBuild(solution, settings =>
    settings.SetPlatformTarget(PlatformTarget.MSIL)
                .SetMaxCpuCount(1)
                .WithProperty("TreatWarningsAsErrors",buildSettings.Build.TreatWarningsAsErrors.ToString())
                .WithTarget("Build")
                .SetConfiguration(configuration));

Seems to work – everything compiles now.

I have also submitted an issue on the msbuild git repository

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSBuild Command-Line Reference
Learn how to use MSBuild.exe command line to build a project or solution file, and several switches you can include.
Read more >
Building Multiple Projects in Parallel with MSBuild
When BuildInParallel is set to true (its default value is true ), multiple worker processes are generated to build as many projects at...
Read more >
msbuild.exe command line with /p:BuildInParallel=true and ...
If the property value is nil, set it to true; Pass its value to the MSBuild.BuildInParallel property. Hard coded pass false when building ......
Read more >
Msbuild get directory name. props imported, or something ...
A Directory. For example, you can set an MSBuild property by using the format: -p:<NAME>=<VALUE>. MSBuild is the default project system in Visual...
Read more >
Untitled
The 'm' parameter is set to 4 to stop too many nodes spawning per-job Share Improve this answer Follow jcpenney commack WebTo use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found