@@ -70,7 +70,7 @@ internal async Task RunDotNetNewAsync(
70
70
// Used to set special options in MSBuild
71
71
IDictionary < string , string > environmentVariables = null )
72
72
{
73
- var hiveArg = $ " --debug:disable-sdk-templates --debug:custom-hive \" { TemplatePackageInstaller . CustomHivePath } \" ";
73
+ var hiveArg = $ "--no-restore --debug:disable-sdk-templates --debug:custom-hive \" { TemplatePackageInstaller . CustomHivePath } \" ";
74
74
var argString = $ "new { templateName } { hiveArg } ";
75
75
environmentVariables ??= new Dictionary < string , string > ( ) ;
76
76
if ( ! string . IsNullOrEmpty ( auth ) )
@@ -113,20 +113,27 @@ internal async Task RunDotNetNewAsync(
113
113
Directory . Delete ( TemplateOutputDir , recursive : true ) ;
114
114
}
115
115
116
- using var execution = ProcessEx . Run ( Output , AppContext . BaseDirectory , DotNetMuxer . MuxerPathOrDefault ( ) , argString , environmentVariables ) ;
117
- await execution . Exited ;
116
+ using var createExecution = ProcessEx . Run ( Output , AppContext . BaseDirectory , DotNetMuxer . MuxerPathOrDefault ( ) , argString , environmentVariables ) ;
117
+ await createExecution . Exited ;
118
118
119
- var result = new ProcessResult ( execution ) ;
119
+ var createResult = new ProcessResult ( createExecution ) ;
120
+ Assert . True ( 0 == createResult . ExitCode , ErrorMessages . GetFailedProcessMessage ( "restore" , this , createResult ) ) ;
121
+
122
+ argString = "restore /bl" ;
123
+ using var restoreExecution = ProcessEx . Run ( Output , TemplateOutputDir , DotNetMuxer . MuxerPathOrDefault ( ) , argString , environmentVariables ) ;
124
+ await restoreExecution . Exited ;
125
+
126
+ var restoreResult = new ProcessResult ( restoreExecution ) ;
120
127
121
128
// Because dotnet new automatically restores but silently ignores restore errors, need to handle restore errors explicitly
122
- if ( errorOnRestoreError && ( execution . Output . Contains ( "Restore failed." ) || execution . Error . Contains ( "Restore failed." ) ) )
129
+ if ( errorOnRestoreError && ( restoreExecution . Output . Contains ( "Restore failed." ) || restoreExecution . Error . Contains ( "Restore failed." ) ) )
123
130
{
124
- result . ExitCode = - 1 ;
131
+ restoreResult . ExitCode = - 1 ;
125
132
}
126
133
127
- CaptureBinLogOnFailure ( execution ) ;
134
+ CaptureBinLogOnFailure ( restoreExecution ) ;
128
135
129
- Assert . True ( 0 == result . ExitCode , ErrorMessages . GetFailedProcessMessage ( "create/ restore" , this , result ) ) ;
136
+ Assert . True ( 0 == restoreResult . ExitCode , ErrorMessages . GetFailedProcessMessage ( "restore" , this , restoreResult ) ) ;
130
137
}
131
138
132
139
internal async Task RunDotNetPublishAsync ( IDictionary < string , string > packageOptions = null , string additionalArgs = null , bool noRestore = true )
0 commit comments