Open jonathanpeppers opened 6 years ago
From @pierceboggan on June 22, 2018 1:28
@kzu Do we know if this reproduces on Windows as well. I'm not sure to what extent this code is shared amongst IDEs.
When I click "Archive" in VS for Windows it triggers a build before archiving, so it seems to work properly there.
@jonathanpeppers & @pierceboggan - Sorry, did I put this issue in the wrong spot?
@slluis the issue is related to a fix we did where VSM would do an explicit build prior to archiving. this caused another issue with AfterBuild targets which would be called twice because the targets we have to call to create the .apk would also do an implicit build.
The reason this fails is that it appears that BuildingInsideVisualStudio
is set to true when we call the targets to create the .apk, which results in the packaging target not building dependent projects - which is the issue here (the common forms project is not built).
Would setting BuildingInsideVisualStudio
to false when we call the package target work?
Thoughts?
@sgmunn Maybe we can add a buildDependencies
argument to Project.RunTarget()
. Although I'm wondering, does the packaging target does no build dependencies, but does it build the project itself?
@slluis the packaging target does build dependent projects but not if BuildingInsideVisualStudio
is true. Why? not sure perhaps @dellis1972 or @jonathanpeppers can answer that directly. If the target is run on the cmdline, the dependent project is built.
From what I understand, this is an MSBuild thing... maybe @dellis1972 can chime in?
On Windows at least, BuildingInsideVisualStudio
tells MSBuild that VS is handling building dependencies. You can see the same thing happen with non-Xamarin.Android projects.
VS is handling building dependencies
ok, so that kind of makes sense. What would be the impact of the android add in simply disabling that property when we build the .apk for archiving - @slluis ?
The problem is that configuration mappings are done at solution level, so if you rely on a project to build its dependencies, it may build the wrong configurations.
You can consider specifying the CurrentSolutionConfigurationContents
which is an XML blob essentially containing the contents of the .sln in XML format. When you build an .sln via MSBuild, you can set the environment variable MSBUILDEMITSOLUTION = 1
, which will persist the generated .sln.metaproj
to disk, and you can see exactly how MSBuild builds a solution. If you mimic what that does, you can ensure that GetTargetPath
on P2P references returns the correct result based on current configuration and platform.
From @adamzucchi on June 11, 2018 2:35
Steps to Reproduce
Expected Behavior
The Android project should create a published archive of the project (.apk)
Actual Behavior
Package creation fails.
However, as noted above if you first build the Android project under the release configuration and then choose to "Archive for Publishing" the archive works as expected.
Version Information
=== Visual Studio Community 2017 for Mac ===
Version 7.5.2 (build 40) Installation UUID: d308199c-14c5-4fad-bbae-24606d319b97 Runtime: Mono 5.10.1.57 (2017-12/ea8a24b1bbf) (64-bit) GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)
=== NuGet ===
Version: 4.3.1.4445
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 2.0.5 2.0.0 SDK: /usr/local/share/dotnet/sdk/2.1.4/Sdks SDK Versions: 2.1.4 2.0.0 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.6.2 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Apple Developer Tools ===
Xcode 9.4 (14160) Build 9F1027a
=== Xamarin.Mac ===
Version: 4.4.1.193 (Visual Studio Community)
=== Xamarin.iOS ===
Version: 11.12.0.4 (Visual Studio Community) Hash: 64fece5f Branch: d15-7 Build date: 2018-05-29 20:00:44-0400
=== Xamarin.Android ===
Version: 8.3.3.2 (Visual Studio Community) Android SDK: /Users/azcreatescode/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 4.0.3 (API level 15) 4.1 (API level 16) 4.2 (API level 17) 4.3 (API level 18) 4.4 (API level 19) 4.4.87 (API level 20) 5.0 (API level 21) 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: 26.0.3
Java SDK: /usr java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, 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: 705020040 Git revision: cfe2fc0566bc4db990242959de40505a13f58352 Build date: 2018-05-30 11:24:18-04 Xamarin addins: 3ac7413ef51a88e06367313c27aec8f7292752a6 Build lane: monodevelop-lion-d15-7
=== Operating System ===
Mac OS X 10.13.5 Darwin 17.6.0 Darwin Kernel Version 17.6.0 Tue May 8 15:22:16 PDT 2018 root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
=== Enabled user installed addins ===
LiveXAML 1.3.31 MvvmCross Template pack 2.0.1 Prism QuickStart TemplatePack 1.5.0 Redth's Addins 1.0.9 Internet of Things (IoT) development (Preview) 7.5
Screenshare Link
Screenshare Steps: Android Archive Bug
Copied from original issue: xamarin/xamarin-android#1805