Support Unity 2020 and earlier
Opened this issue · 0 comments
DaZombieKiller commented
Updating Roslyn:
- Delete everything in
Editor/Data/Tools/Roslyn/
exceptCoreRun.exe
- Copy
dotnet/shared/Microsoft.NETCore.App/<latest>/*
intoEditor/Data/Tools/Roslyn/
- Copy
dotnet/sdk/<latest>/Roslyn/bincore/*
intoEditor/Data/Tools/Roslyn/
Patches (Editor/Data/Managed/UnityEditor.dll
):
UnityEditor.Modules.DefaultCompilationExtension.GetCsCompiler
:return CSharpCompiler.Microsoft
UnityEditor.Scripting.Compilers.CSharpLanguage.GetCSharpCompiler
:return CSharpCompiler.Microsoft
UnityEditor.Scripting.Compilers.MicrosoftCSharpCompiler.StartCompilerImpl
:"csc.exe"
->"csc.dll"
UnityEditor.VisualStudioIntegration.SolutionSynchronizer.ProjectHeader
:"4"
->"latest"
,"6"
->"latest"
(targetLanguageVersion
)UnityEditor.EditorUtility.CompileCSharp
: T.B.D.
The resulting PDB files from a compilation also need to be converted to MDB. This can be performed using the pdb2mdb
utility bundled with Mono (and therefore also bundled with Unity). It should be invoked through MonoBleedingEdge/bin/mono.exe
and not directly, otherwise it will fail to locate Mono.Cecil.dll
in the bundled GAC and not generate an MDB.
The following batch script demonstrates what should occur following a compilation:
cd Library\ScriptAssemblies
set MONO_ROOT=%UNITY_INSTALL_DIR%\Editor\Data\MonoBleedingEdge
for %%f in (*.pdb) do "%MONO_ROOT%\bin\mono.exe" "%MONO_ROOT%\lib\mono\4.5\pdb2mdb.exe" "%%~nf.dll"