Sfoglia il codice sorgente

change runprebuild.bat to try to find msbuild of most recent visual studio instaled for compile.bat

UbitUmarov 5 anni fa
parent
commit
28171e1d10
1 ha cambiato i file con 28 aggiunte e 15 eliminazioni
  1. 28 15
      runprebuild.bat

+ 28 - 15
runprebuild.bat

@@ -1,12 +1,26 @@
 @echo OFF
 @echo OFF
 
 
-bin\Prebuild.exe /target nant
 bin\Prebuild.exe /target vs2015
 bin\Prebuild.exe /target vs2015
 
 
 setlocal ENABLEEXTENSIONS
 setlocal ENABLEEXTENSIONS
-set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0"
 set VALUE_NAME=MSBuildToolsPath
 set VALUE_NAME=MSBuildToolsPath
 
 
+
+rem try find vs2017
+if "%PROCESSOR_ARCHITECTURE%"=="x86" set PROGRAMS=%ProgramFiles%
+if defined ProgramFiles(x86) set PROGRAMS=%ProgramFiles(x86)%
+
+for %%e in (Enterprise Professional Community) do (
+
+    if exist "%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\MSBuild.exe" (
+
+        set ValueValue="%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\"
+		goto :found
+    )
+
+)
+
+
 rem We have to use grep or find to locate the correct line, because reg query spits
 rem We have to use grep or find to locate the correct line, because reg query spits
 rem out 4 lines before Windows 7 but 2 lines after Windows 7.
 rem out 4 lines before Windows 7 but 2 lines after Windows 7.
 rem We use grep if it's on the path; otherwise we use the built-in find command
 rem We use grep if it's on the path; otherwise we use the built-in find command
@@ -19,20 +33,19 @@ if defined FOUNDGREP (
   set FINDCMD=find
   set FINDCMD=find
 )
 )
 
 
-FOR /F "usebackq tokens=1-3" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul ^| %FINDCMD% "%VALUE_NAME%"`) DO (
-    set ValueName=%%A
-    set ValueType=%%B
-    set ValueValue=%%C
+
+for %%v in (14.0, 12.0, 4.0) do (
+	FOR /F "usebackq tokens=1-3" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%%v" /v %VALUE_NAME% 2^>nul ^| %FINDCMD% "%VALUE_NAME%"`) DO (
+		set ValueValue=%%C
+		goto :found
+	)
 )
 )
 
 
-if defined ValueName (
-    @echo Found msbuild path registry entry
-    @echo Value Name = %ValueName%
-    @echo Value Type = %ValueType%
-    @echo Value Value = %ValueValue%
+@echo %KEY_NAME%\%VALUE_NAME% not found.
+@echo Not creating compile.bat
+exit
+
+:found
+    @echo Found msbuild at %ValueValue%
     @echo Creating compile.bat
     @echo Creating compile.bat
     @echo %ValueValue%\msbuild opensim.sln > compile.bat
     @echo %ValueValue%\msbuild opensim.sln > compile.bat
-) else (
-    @echo %KEY_NAME%\%VALUE_NAME% not found.
-    @echo Not creating compile.bat
-)