@@ -462,7 +462,11 @@ public virtual ModuleBuilder CreateModuleBuilder ()
462462 // but returned ISymbolWriter does not have all what we need therefore some
463463 // adaptor will be needed for now we alwayas emit MDB format when generating
464464 // debug info
465+ #if NET6_0
466+ return Builder . DefineDynamicModule ( module_name ) ;
467+ #else
465468 return Builder . DefineDynamicModule ( module_name , module_name , false ) ;
469+ #endif
466470 }
467471
468472 public virtual void Emit ( )
@@ -787,11 +791,13 @@ public void EmbedResources ()
787791 //
788792 // Add Win32 resources
789793 //
794+ #if ! NET6_0
790795 if ( Compiler . Settings . Win32ResourceFile != null ) {
791796 Builder . DefineUnmanagedResource ( Compiler . Settings . Win32ResourceFile ) ;
792797 } else {
793798 Builder . DefineVersionInfoResource ( vi_product , vi_product_version , vi_company , vi_copyright , vi_trademark ) ;
794799 }
800+ #endif
795801
796802 if ( Compiler . Settings . Win32IconFile != null ) {
797803 builder_extra . DefineWin32IconResource ( Compiler . Settings . Win32IconFile ) ;
@@ -819,9 +825,13 @@ public void EmbedResources ()
819825 stream = new MemoryStream ( File . ReadAllBytes ( res . FileName ) ) ;
820826 }
821827
828+ #if ! NET6_0
822829 module . Builder . DefineManifestResource ( res . Name , stream , res . Attributes ) ;
830+ #endif
823831 } else {
832+ #if ! NET6_0
824833 Builder . AddResourceFile ( res . Name , Path . GetFileName ( res . FileName ) , res . Attributes ) ;
834+ #endif
825835 }
826836 }
827837 }
@@ -871,7 +881,11 @@ public void Save ()
871881 if ( Compiler . Settings . Target == Target . Module ) {
872882 SaveModule ( pekind , machine ) ;
873883 } else {
884+ #if NET6_0
885+ throw new NotSupportedException ( ) ;
886+ #else
874887 Builder . Save ( module . Builder . ScopeName , pekind , machine ) ;
888+ #endif
875889 }
876890 } catch ( Exception e ) {
877891 Report . Error ( 16 , "Could not write to file `" + name + "', cause: " + e . Message ) ;
@@ -964,7 +978,9 @@ void SetEntryPoint ()
964978 return ;
965979 }
966980
981+ #if ! NET6_0
967982 Builder . SetEntryPoint ( entry_point . MethodBuilder , file_kind ) ;
983+ #endif
968984 }
969985
970986 void Error_ObsoleteSecurityAttribute ( Attribute a , string option )
@@ -1043,14 +1059,14 @@ public AssemblyResource (string fileName, string name, bool isPrivate)
10431059 public string FileName { get ; private set ; }
10441060 public bool IsEmbeded { get ; set ; }
10451061
1046- #region IEquatable<AssemblyResource> Members
1062+ #region IEquatable<AssemblyResource> Members
10471063
10481064 public bool Equals ( AssemblyResource other )
10491065 {
10501066 return Name == other . Name ;
10511067 }
10521068
1053- #endregion
1069+ #endregion
10541070 }
10551071
10561072 //
@@ -1258,4 +1274,16 @@ protected void LoadReferencesCore (ModuleContainer module, out T corlib_assembly
12581274 compiler . TimeReporter . Stop ( TimeReporter . TimerType . ReferencesLoading ) ;
12591275 }
12601276 }
1261- }
1277+
1278+ #if NET6_0
1279+
1280+ enum PEFileKinds
1281+ {
1282+ Dll = 1 ,
1283+ ConsoleApplication = 2 ,
1284+ WindowApplication = 3
1285+ }
1286+
1287+ #endif
1288+
1289+ }
0 commit comments