Skip to content

Instantly share code, notes, and snippets.

@zoon
Last active February 25, 2019 11:04
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zoon/d35a0777bd83d2971a1ec10ecff2c060 to your computer and use it in GitHub Desktop.
Save zoon/d35a0777bd83d2971a1ec10ecff2c060 to your computer and use it in GitHub Desktop.
Latest version of Roslyn for unity.incrementalcompiler
@rem update-unity-compiler.cmd
@rem start in */com.unity.incrementalcompiler@X.Y.ZZ folder
@echo off
@rem NOTE: FIND.EXE can clash with git/msys/cygwin's find
for %%a in (%ComSpec%) do set __system=%%~dpa
%__system%FIND.EXE /i "com.unity.incrementalcompiler" package.json 1> NUL
if %errorlevel% neq 0 goto :not_found
nuget install Microsoft.Net.Compilers -verbosity quiet
if %errorlevel% neq 0 goto :nuget_error
for /F %%D in ('dir /b Microsoft.Net.Compilers*') do set __roslyn_dir=%%D
if not defined __roslyn_dir goto :unknown_error
xcopy %__roslyn_dir%\tools\*.dll .bin\ /u /r /y 1> NUL
if %errorlevel% neq 0 goto :xcopy_error
@rem kudos to: https://gist.github.com/SugoiDev/3790be804e356c5440b092477218f156
xcopy %__roslyn_dir%\tools\csc.exe.config .bin\ /u /f /r /y
if %errorlevel% neq 0 goto :xcopy_error
echo Success:
echo %__roslyn_dir% installed
goto :cleanup
:not_found
echo ERROR: com.unity.incrementalcompiler package is not here.
goto :eof
:nuget_error
echo ERROR: NuGet error (do you have it installed?).
goto :cleanup
:xcopy_error
echo ERROR: Error copying files, try to close all Unity instances.
goto :cleanup
:unknown_error
echo ERROR: unknown
goto :cleanup
:cleanup
if defined __roslyn_dir rmdir %__roslyn_dir% /s /q
set __system=
set __roslyn_dir=
:eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment