Search Unity

Building A Clean Uwp Project From Command Line

Discussion in 'Editor & General Support' started by giacomohomunculus, Apr 10, 2019.

  1. giacomohomunculus

    giacomohomunculus

    Joined:
    Oct 3, 2018
    Posts:
    20
    I am using the following .gitignore for my Unity project:

    https://github.com/github/gitignore/blob/master/Unity.gitignore

    When I clone the project, and immediately run the command:

    '"C:\Program Files\Unity\Editor\Unity.exe" -projectPath %cd% -batchmode -nographics -quit -executeMethod BuildScript.PerformBuild'

    With the script being:

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3. using System.IO;
    4.  
    5. public class BuildScript : MonoBehaviour
    6. {
    7.     [MenuItem("Build/Build UWP")]
    8.     public static void PerformBuild()
    9.     {
    10.         BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
    11.  
    12.         buildPlayerOptions.scenes = new[] {
    13.             "Assets/Scenes/WMRBase.unity",
    14.             "Assets/Scenes/Start.unity",
    15.             "Assets/Scenes/Login.unity",
    16.             "Assets/Scenes/Jobs.unity",
    17.             "Assets/Scenes/Main.unity",
    18.             "Assets/Scenes/Settings.unity",
    19.         };
    20.  
    21.         var outputFile = "./UWP/";
    22.         if (File.Exists(outputFile))
    23.         {
    24.             File.Delete(outputFile);
    25.         }
    26.         buildPlayerOptions.locationPathName = outputFile;
    27.         buildPlayerOptions.target = BuildTarget.WSAPlayer;
    28.         buildPlayerOptions.targetGroup = BuildTargetGroup.WSA;
    29.  
    30.         BuildPipeline.BuildPlayer(buildPlayerOptions);
    31.         }
    32.     }
    33. }
    34.  
    This creates a UWP directory with a project.json and projectlock.json but no VS solution.

    When I open the project in the editor, then manually change the build settings to UWP, save the project, close the project, then run that same command from the terminal, it builds ok.

    Any ideas?
     
  2. giacomohomunculus

    giacomohomunculus

    Joined:
    Oct 3, 2018
    Posts:
    20
    Looking thru the logs (cant post them, sorry), I see Vuforia isn't importing:

    -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll
    Microsoft (R) Visual C# Compiler version 42.42.42.42424
    Copyright (C) Microsoft Corporation. All rights reserved.

    Assets\Boeing\Alignment\Scripts\ImageTargetPose.cs(4,7): error CS0246: The type or namespace name 'Vuforia' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Boeing\Alignment\Scripts\ImageTargetPose_bak.cs(4,7): error CS0246: The type or namespace name 'Vuforia' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Scripts\Common\ManageVuforia.cs(4,7): error CS0246: The type or namespace name 'Vuforia' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Scripts\Common\NoAR.cs(2,7): error CS0246: The type or namespace name 'Vuforia' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Scripts\Common\NoVuforiaInstance.cs(2,7): error CS0246: The type or namespace name 'Vuforia' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Scripts\Common\VuforiaCameraIssueFix.cs(5,7): error CS0246: The type or namespace name 'Vuforia' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Scripts\Common\VuforiaDisabler.cs(5,7): error CS0246: The type or namespace name 'Vuforia' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Scripts\Main\Vuforia\VuforiaManager.cs(2,7): error CS0246: The type or namespace name 'Vuforia' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Vuforia\Scripts\DefaultInitializationErrorHandler.cs(10,7): error CS0246: The type or namespace name 'Vuforia' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Vuforia\Scripts\DefaultTrackableEventHandler.cs(10,7): error CS0246: The type or namespace name 'Vuforia' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Boeing\Alignment\Scripts\ImageTargetPose.cs(13,24): error CS0246: The type or namespace name 'TrackableBehaviour' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Vuforia\Scripts\DefaultTrackableEventHandler.cs(15,60): error CS0246: The type or namespace name 'ITrackableEventHandler' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Boeing\Alignment\Scripts\ImageTargetPose_bak.cs(11,24): error CS0246: The type or namespace name 'TrackableBehaviour' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Vuforia\Scripts\DefaultInitializationErrorHandler.cs(19,46): error CS0246: The type or namespace name 'VuforiaUnity' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Vuforia\Scripts\DefaultTrackableEventHandler.cs(47,9): error CS0246: The type or namespace name 'TrackableBehaviour' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Vuforia\Scripts\DefaultTrackableEventHandler.cs(48,9): error CS0246: The type or namespace name 'TrackableBehaviour' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Vuforia\Scripts\DefaultInitializationErrorHandler.cs(98,23): error CS0246: The type or namespace name 'VuforiaUnity' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Vuforia\Scripts\DefaultTrackableEventHandler.cs(19,15): error CS0246: The type or namespace name 'TrackableBehaviour' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Scripts\Sharing\CustomMessagesHandler.cs(191,10): warning CS0114: 'CustomMessagesHandler.OnDestroy()' hides inherited member 'Singleton<CustomMessagesHandler>.OnDestroy()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
    -----CompilerOutput:-stderr----------
    -----EndCompilerOutput---------------

    ..Why?
     
  3. giacomohomunculus

    giacomohomunculus

    Joined:
    Oct 3, 2018
    Posts:
    20