@@ -48,8 +48,19 @@ class MakeBundle {
4848 static bool keeptemp = false ;
4949 static bool compile_only = false ;
5050 static bool static_link = false ;
51- static string config_file = null ;
51+
52+ // Points to the $sysconfig/mono/4.5/machine.config, which contains System.Configuration settings
5253 static string machine_config_file = null ;
54+
55+ // By default, we automatically bundle a machine-config, use this to turn off the behavior.
56+ static bool no_machine_config = false ;
57+
58+ // Points to the $sysconfig/mono/config file, contains <dllmap> and others
59+ static string config_file = null ;
60+
61+ // By default, we automatically bundle the above config file, use this to turn off the behavior.
62+ static bool no_config = false ;
63+
5364 static string config_dir = null ;
5465 static string style = "linux" ;
5566 static bool bundled_header = false ;
@@ -65,7 +76,7 @@ class MakeBundle {
6576 static string fetch_target = null ;
6677 static bool custom_mode = true ;
6778 static string embedded_options = null ;
68-
79+
6980 static string runtime = null ;
7081
7182 static bool aot_compile = false ;
@@ -148,7 +159,7 @@ static int Main (string [] args)
148159 return 1 ;
149160 }
150161 if ( sdk_path != null || runtime != null )
151- Error ( "You can only specify one of --runtime, --sdk or --cross" ) ;
162+ Error ( "You can only specify one of --runtime, --sdk or --cross {sdk_path}/{runtime} " ) ;
152163 custom_mode = false ;
153164 autodeps = true ;
154165 cross_target = args [ ++ i ] ;
@@ -289,6 +300,12 @@ static int Main (string [] args)
289300 if ( ! quiet )
290301 Console . WriteLine ( "WARNING:\n Check that the machine.config file you are bundling\n doesn't contain sensitive information specific to this machine." ) ;
291302 break ;
303+ case "--no-machine-config" :
304+ no_machine_config = true ;
305+ break ;
306+ case "--no-config" :
307+ no_config = true ;
308+ break ;
292309 case "--config-dir" :
293310 if ( i + 1 == top ) {
294311 Help ( ) ;
@@ -523,6 +540,18 @@ static void VerifySdk (string path)
523540 if ( ! Directory . Exists ( lib_path ) )
524541 Error ( $ "The SDK location does not contain a { path } /lib/mono/4.5 directory") ;
525542 link_paths . Add ( lib_path ) ;
543+ if ( machine_config_file == null && ! no_machine_config ) {
544+ machine_config_file = Path . Combine ( path , "etc" , "mono" , "4.5" , "machine.config" ) ;
545+ if ( ! File . Exists ( machine_config_file ) ) {
546+ Error ( $ "Could not locate the file machine.config file at ${ machine_config_file } use --machine-config FILE or --no-machine-config") ;
547+ }
548+ }
549+ if ( config_file == null && ! no_config ) {
550+ config_file = Path . Combine ( path , "etc" , "mono" , "config" ) ;
551+ if ( ! File . Exists ( config_file ) ) {
552+ Error ( $ "Could not locate the file config file at ${ config_file } use --config FILE or --no-config") ;
553+ }
554+ }
526555 }
527556
528557 static string targets_dir = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . Personal ) , ".mono" , "targets" ) ;
0 commit comments