@@ -20,6 +20,26 @@ public class BuildDeployTools
2020 {
2121 public static readonly string DefaultMSBuildVersion = "14.0" ;
2222
23+ public static bool CanBuild ( )
24+ {
25+ if ( PlayerSettings . GetScriptingBackend ( BuildTargetGroup . WSA ) == ScriptingImplementation . IL2CPP && IsIl2CppAvailable ( ) )
26+ {
27+ return true ;
28+ }
29+
30+ return PlayerSettings . GetScriptingBackend ( BuildTargetGroup . WSA ) == ScriptingImplementation . WinRTDotNET && IsDotNetAvailable ( ) ;
31+ }
32+
33+ public static bool IsDotNetAvailable ( )
34+ {
35+ return Directory . Exists ( EditorApplication . applicationContentsPath + "\\ PlaybackEngines\\ MetroSupport\\ Managed\\ UAP" ) ;
36+ }
37+
38+ public static bool IsIl2CppAvailable ( )
39+ {
40+ return Directory . Exists ( EditorApplication . applicationContentsPath + "\\ PlaybackEngines\\ MetroSupport\\ Managed\\ il2cpp" ) ;
41+ }
42+
2343 public static bool BuildSLN ( string buildDirectory , bool showDialog = true )
2444 {
2545 // Use BuildSLNUtilities to create the SLN
@@ -53,6 +73,7 @@ public static bool BuildSLN(string buildDirectory, bool showDialog = true)
5373 BuildDeployPrefs . MsBuildVersion ,
5474 BuildDeployPrefs . ForceRebuild ,
5575 BuildDeployPrefs . BuildConfig ,
76+ BuildDeployPrefs . BuildPlatform ,
5677 BuildDeployPrefs . BuildDirectory ,
5778 BuildDeployPrefs . IncrementBuildVersion ) ;
5879 }
@@ -80,7 +101,7 @@ public static string CalcMSBuildPath(string msBuildVersion)
80101 {
81102 if ( key != null )
82103 {
83- var msBuildBinFolder = ( string ) key . GetValue ( "MSBuildToolsPath" ) ;
104+ var msBuildBinFolder = ( string ) key . GetValue ( "MSBuildToolsPath" ) ;
84105 return Path . Combine ( msBuildBinFolder , "msbuild.exe" ) ;
85106 }
86107 }
@@ -156,7 +177,7 @@ public static bool RestoreNugetPackages(string nugetPath, string storePath)
156177 return File . Exists ( storePath + "\\ project.lock.json" ) ;
157178 }
158179
159- public static bool BuildAppxFromSLN ( string productName , string msBuildVersion , bool forceRebuildAppx , string buildConfig , string buildDirectory , bool incrementVersion , bool showDialog = true )
180+ public static bool BuildAppxFromSLN ( string productName , string msBuildVersion , bool forceRebuildAppx , string buildConfig , string buildPlatform , string buildDirectory , bool incrementVersion , bool showDialog = true )
160181 {
161182 EditorUtility . DisplayProgressBar ( "Build AppX" , "Building AppX Package..." , 0 ) ;
162183 string slnFilename = Path . Combine ( buildDirectory , PlayerSettings . productName + ".sln" ) ;
@@ -218,10 +239,11 @@ public static bool BuildAppxFromSLN(string productName, string msBuildVersion, b
218239 {
219240 FileName = vs ,
220241 CreateNoWindow = false ,
221- Arguments = string . Format ( "\" {0}\" /t:{2 } /p:Configuration={1 } /p:Platform=x86 /verbosity:m" ,
242+ Arguments = string . Format ( "\" {0}\" /t:{1 } /p:Configuration={2 } /p:Platform={3} /verbosity:m" ,
222243 solutionProjectPath ,
244+ forceRebuildAppx ? "Rebuild" : "Build" ,
223245 buildConfig ,
224- forceRebuildAppx ? "Rebuild" : "Build" )
246+ buildPlatform )
225247 } ;
226248
227249 // Uncomment out to debug by copying into command window
0 commit comments