@@ -44,8 +44,6 @@ public class NugetConfigFile
4444
4545 private const string RequestTimeoutSecondsConfigKey = "RequestTimeoutSeconds" ;
4646
47- private const string LockPackagesOnRestoreConfigKey = "LockPackagesOnRestore" ;
48-
4947 private const string PackagesConfigDirectoryPathConfigKey = "PackagesConfigDirectoryPath" ;
5048
5149 /// <summary>
@@ -88,6 +86,12 @@ public class NugetConfigFile
8886 /// </summary>
8987 public bool Verbose { get ; set ; }
9088
89+ /// <summary>
90+ /// Gets or sets a value indicating whether to skip installing dependencies and checking for pre-imported Unity libs
91+ /// while auto-restoring.
92+ /// </summary>
93+ public bool SlimRestore { get ; set ; } = true ;
94+
9195 /// <summary>
9296 /// Gets or sets a value indicating whether a package is installed from the cache (if present), or if it always downloads the package from the
9397 /// server.
@@ -126,12 +130,6 @@ public string RelativePackagesConfigDirectoryPath
126130 /// </summary>
127131 public int RequestTimeoutSeconds { get ; set ; } = DefaultRequestTimeout ;
128132
129- /// <summary>
130- /// Gets or sets a value indicating whether the installed packages should be fixed, so only the packages that are configure inside the
131- /// 'package.config' are installed without installing the dependencies of them.
132- /// </summary>
133- public bool LockPackagesOnRestore { get ; set ; }
134-
135133 /// <summary>
136134 /// Loads a NuGet.config file at the given file-path.
137135 /// </summary>
@@ -260,6 +258,10 @@ public static NugetConfigFile Load([NotNull] string filePath)
260258 {
261259 configFile . Verbose = bool . Parse ( value ) ;
262260 }
261+ else if ( string . Equals ( key , "slimRestore" , StringComparison . OrdinalIgnoreCase ) )
262+ {
263+ configFile . SlimRestore = bool . Parse ( value ) ;
264+ }
263265 else if ( string . Equals ( key , "InstallFromCache" , StringComparison . OrdinalIgnoreCase ) )
264266 {
265267 configFile . InstallFromCache = bool . Parse ( value ) ;
@@ -272,10 +274,6 @@ public static NugetConfigFile Load([NotNull] string filePath)
272274 {
273275 configFile . RequestTimeoutSeconds = int . Parse ( value , CultureInfo . InvariantCulture ) ;
274276 }
275- else if ( string . Equals ( key , LockPackagesOnRestoreConfigKey , StringComparison . OrdinalIgnoreCase ) )
276- {
277- configFile . LockPackagesOnRestore = bool . Parse ( value ) ;
278- }
279277 else if ( string . Equals ( key , PackagesConfigDirectoryPathConfigKey , StringComparison . OrdinalIgnoreCase ) )
280278 {
281279 configFile . RelativePackagesConfigDirectoryPath = value ;
@@ -306,6 +304,7 @@ public static NugetConfigFile CreateDefaultFile([NotNull] string filePath)
306304 <config>
307305 <add key=""repositoryPath"" value=""./Packages"" />
308306 <add key=""PackagesConfigDirectoryPath"" value=""."" />
307+ <add key=""slimRestore"" value=""true"" />
309308 </config>
310309</configuration>" ;
311310
@@ -402,6 +401,11 @@ public void Save([NotNull] string filePath)
402401 config . Add ( addElement ) ;
403402 }
404403
404+ addElement = new XElement ( "add" ) ;
405+ addElement . Add ( new XAttribute ( "key" , "slimRestore" ) ) ;
406+ addElement . Add ( new XAttribute ( "value" , SlimRestore . ToString ( ) . ToLowerInvariant ( ) ) ) ;
407+ config . Add ( addElement ) ;
408+
405409 if ( ! InstallFromCache )
406410 {
407411 addElement = new XElement ( "add" ) ;
@@ -426,14 +430,6 @@ public void Save([NotNull] string filePath)
426430 config . Add ( addElement ) ;
427431 }
428432
429- if ( LockPackagesOnRestore )
430- {
431- addElement = new XElement ( "add" ) ;
432- addElement . Add ( new XAttribute ( "key" , LockPackagesOnRestoreConfigKey ) ) ;
433- addElement . Add ( new XAttribute ( "value" , LockPackagesOnRestore . ToString ( ) . ToLowerInvariant ( ) ) ) ;
434- config . Add ( addElement ) ;
435- }
436-
437433 var configuration = new XElement ( "configuration" ) ;
438434 configuration . Add ( packageSources ) ;
439435 configuration . Add ( disabledPackageSources ) ;
0 commit comments