File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 4747 <Compile Include =" ..\CompilerPlugin\CSharp60SupportActivator.cs" >
4848 <Link >CSharp60SupportActivator.cs</Link >
4949 </Compile >
50+ <Compile Include =" ..\CompilerPlugin\CSharpProjectProcessor.cs" >
51+ <Link >CSharpProjectProcessor.cs</Link >
52+ </Compile >
5053 <Compile Include =" ..\CompilerPlugin\CustomCSharpCompiler.cs" >
5154 <Link >CustomCSharpCompiler.cs</Link >
5255 </Compile >
Original file line number Diff line number Diff line change 4848 <Compile Include =" ..\CompilerPlugin\CSharp60SupportActivator.cs" >
4949 <Link >CSharp60SupportActivator.cs</Link >
5050 </Compile >
51+ <Compile Include =" ..\CompilerPlugin\CSharpProjectProcessor.cs" >
52+ <Link >CSharpProjectProcessor.cs</Link >
53+ </Compile >
5154 <Compile Include =" ..\CompilerPlugin\CustomCSharpCompiler.cs" >
5255 <Link >CustomCSharpCompiler.cs</Link >
5356 </Compile >
Original file line number Diff line number Diff line change 1+ using System . IO ;
2+ using System . Linq ;
3+ using UnityEditor ;
4+
5+ public class CSharpProjectProcessor : AssetPostprocessor
6+ {
7+ private static bool OnPreGeneratingCSProjectFiles ( )
8+ {
9+ var currentDirectory = Directory . GetCurrentDirectory ( ) ;
10+ var projectFiles = Directory . GetFiles ( currentDirectory , "*.csproj" ) ;
11+
12+ foreach ( var file in projectFiles )
13+ {
14+ UpdateProjectFile ( file ) ;
15+ }
16+
17+ return false ;
18+ }
19+
20+ private static void UpdateProjectFile ( string file )
21+ {
22+ var lines = File . ReadAllLines ( file ) ;
23+ lines = lines . Where ( line => line . Contains ( "LangVersion" ) == false ) . ToArray ( ) ;
24+ File . WriteAllLines ( file , lines ) ;
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments