Skip to content

Instantly share code, notes, and snippets.

@SugoiDev
Forked from zoon/update-unity-compiler.cmd
Created July 24, 2018 08:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SugoiDev/3790be804e356c5440b092477218f156 to your computer and use it in GitHub Desktop.
Save SugoiDev/3790be804e356c5440b092477218f156 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 /f /r /y
if %errorlevel% neq 0 goto :xcopy_error
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
@SugoiDev
Copy link
Author

Forked to make it also copy the csc.exe.config file, as this seems to be necessary for Incremental Compiler 0.0.42.preview.13+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment