dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.24k stars 1.35k forks source link

Setting IntermediateOutputPath in msbuild command causes javac error in Xamarin Forms droid project #3232

Open awattar opened 6 years ago

awattar commented 6 years ago

Steps to reproduce

  1. Create Xamarin Forms project.
  2. Build Android part of the solution using msbuild from command line.

Command line

  msbuild ./ProjectName.sln \
   /t:ProjectName_Droid:SignAndroidPackage \
   /p:Configuration="Release" \
   /p:Platform="Any CPU" \
   /p:OutputPath="/absolute/path/bin/" \
   /p:IntermediateOutputPath="/absolute/path/obj/" 

Expected behavior

Builds fine without errors.

Actual behavior

Build files are created in specified Output and Intermediate locations but various errors occurs like:

javac error :  error: package com.sample.package.name does not exist

Environment data

Visual Studio Enterprise 2017 for Mac Version 7.4.3 (build 10) Installation UUID: fc295dbb-ea60-45ea-a7bd-051b091fe655 Runtime: Mono 5.8.1.0 (2017-10/6bf3922f3fd) (64-bit) GTK+ 2.24.23 (Raleigh theme)

Package version: 508010000

NuGet Version: 4.3.1.4445

.NET Core Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 2.0.5 2.0.0 1.1.1 1.0.4 SDK: /usr/local/share/dotnet/sdk/2.1.4/Sdks SDK Versions: 2.1.4 2.0.0 1.0.3 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.8.1/lib/mono/msbuild/15.0/bin/Sdks

Xamarin.Profiler Version: 1.6.1 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Apple Developer Tools Xcode 9.4 (14155) Build 9Q1004a

Xamarin.Mac Version: 4.2.1.29 (Visual Studio Enterprise)

Xamarin.iOS Version: 11.9.1.24 (Visual Studio Enterprise) Hash: f62de472 Branch: xcode9.3 Build date: 2018-03-29 19:30:53-0400

Xamarin.Android Version: 8.2.0.16 (Visual Studio Enterprise) Android SDK: /Users/mwesolowski/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 5.1 (API level 22) 6.0 (API level 23) 7.0 (API level 24) 7.1 (API level 25) 8.0 (API level 26) 8.1 (API level 27)

SDK Tools Version: 26.1.1 SDK Platform Tools Version: 27.0.1 SDK Build Tools Version: 27.0.3

Java SDK: /usr java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

Xamarin Inspector Version: 1.4.0 Hash: b3f92f9 Branch: master Build date: Fri, 19 Jan 2018 22:00:34 GMT Client compatibility: 1

Build Information Release ID: 704030010 Git revision: 5af3e98549653fcc5335896ccc296343d08f31bb Build date: 2018-04-12 12:32:07-04 Xamarin addins: fadb82fb0fe2668cb7789f8b524aec6fb8568ee7 Build lane: monodevelop-lion-d15-6

Operating System Mac OS X 10.13.4 Darwin 17.5.0 Darwin Kernel Version 17.5.0 Mon Mar 5 22:24:32 PST 2018 root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64

Enabled user installed addins Internet of Things (IoT) development (Preview) 7.1

OS info:

Mac OS X 10.13.4

jonathanpeppers commented 3 years ago

We saw something similar to this here:

https://discord.com/channels/732297728826277939/732297837953679412/788597182039195648

In this example, ResolveAssemblyReference was not returning a reference, but the dependencies were:

LibVLCSharp.Forms.Sample.Android (Android project) ->  LibVLCSharp.Forms (MSBuild.Sdk.Extras) -> LibVLCSharp (MSBuild.Sdk.Extras) -> LibVLCSharp.AWindow (Android binding project)

LibVLCSharp.AWindow.dll was missing (it contained a Java binding). This caused the javac error. The workaround was to reference the bindings project from the Android head project.

@awattar can you share a diagnostic MSBuild log? I'm wondering if your case is different, or if you are using MSBuild.Sdk.Extras.

awattar commented 3 years ago

Hi @jonathanpeppers it was over 2 years ago and we skipped this approach. I can try to reproduce this and check for the Extras.