Search Issue Tracker

Fixed in 2020.2.X

Fixed in 2019.4.X, 2020.1.X

Votes

4

Found in

2017.4.0f1

2018.4.0f1

2018.4.1f1

2019.1.0a1

2019.2.0a1

2019.3.0a1

Issue ID

1165205

Regression

No

[UWP] Building multi-platform .appxbundle via MSBuild fails with IL2CPP scripting backend

How to reproduce:
1. Create a new empty project
2. Switch Target platform to UWP
3. Set 'Scripting Backend' to IL2CPP
4. Build the project
5. Open the PowerShell in the Build directory
6. Execute the following commands:
1. $msbuild='C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe'
2. & $msbuild .\<PROJECT-NAME>.sln /t:"restore,build" /p:"AppxBundle=Always;AppxBundlePlatforms=x86|ARM" /p:Configuration=Master > build.txt 2>&1
3. $LASTEXITCODE

Expected result: "0" is printed out (meaning that the building was successful)
Actual result: "1" is printed out (meaning that the building failed)

Reproducible with - 2017.4.0f1, 2017.4.29f1, 2018.4.3f1, 2019.1.8f1, 2019.2.0b8, 2019.3.0a8

UPDATE:

This is caused by a "feature" in MSBuild were the output directory is nested when performing a multi-platform build. This functionality must be explicitly disabled to build the Unity generated project. The issue is discussed on these MS developer sites:

https://developercommunity.visualstudio.com/content/problem/164983/creating-uwp-appxbundle-works-in-vs-store-wizard-b.html
https://github.com/microsoft/MixedRealityToolkit-Unity/issues/7351
https://github.com/Microsoft/msbuild/issues/2445

To work around this issue pass: "/p:UseSubFolderForOutputDirDuringMultiPlatformBuild=false" on the MSBuild command line.
For example:

& $msbuild .\<PROJECT-NAME>.sln /t:"restore,build" /p:"AppxBundle=Always;AppxBundlePlatforms=x86|ARM" /p:Configuration=Master /p:UseSubFolderForOutputDirDuringMultiPlatformBuild=false > build.txt 2>&1

  1. Resolution Note (fix version 2020.2):

    Adds <UseSubFolderForOutputDirDuringMultiPlatformBuild>false</UseSubFolderForOutputDirDuringMultiPlatformBuild> to the Unity generated Visual Studio project.

  2. Resolution Note (fix version 2020.1):

    Fixed in: 2020.1.4f1

  3. Resolution Note (fix version 2019.4):

    Fixed in: 2019.4.10f1

Comments (1)

  1. camogram

    Mar 13, 2020 04:14

    Some notes from my testing: (2018.4.18f1):

    1: Platform="x86";AppxBundlePlatforms="x86";Configuration=Master;AppxBundle=Always;
    2: Platform="ARM";AppxBundlePlatforms="ARM";Configuration=Master;AppxBundle=Always;
    3: Platform="x86|ARM";AppxBundlePlatforms="x86|ARM";Configuration=Master;AppxBundle=Always;
    4: AppxBundlePlatforms="x86|ARM";Configuration=Master;AppxBundle=Always;
    5: AppxBundlePlatforms="x86";Configuration=Master;AppxBundle=Always;

    1 & 2 Build OK (but only for one platform).
    3 is an invalid configuration (Only one platform can be specified)
    4 (OP) Attempts to build the x86 project to ARM folders - strange. Fails before attempting 'actual' ARM project.
    5 Same result as in 4.

    I have not tested changing the 'Architecture' output between x86 and ARM in the Unity GUI - though I presume this would result in the same (reverse) error.

    A cursory glance suggests this is an msbuild limitation as much as a unity one.

    References:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/6c1b03aa-f661-496e-94ca-26c0472aefff/can-msbuild-create-an-appxbundle-for-multiple-platforms?forum=msbuild

    https://github.com/Microsoft/msbuild/issues/2445

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.