@@ -172,7 +172,7 @@ private static BuildScript DownloadDotNet(IAutobuilder<AutobuildOptionsShared> b
172172
173173 const string latestDotNetSdkVersion = "8.0.101" ;
174174 builder . Log ( Severity . Info , $ "No .NET Core SDK found. Attempting to install version { latestDotNetSdkVersion } .") ;
175- return DownloadDotNetVersion ( builder , installDir , latestDotNetSdkVersion ) ;
175+ return DownloadDotNetVersion ( builder , installDir , latestDotNetSdkVersion , checkInstalledSdkVersion : false ) ;
176176 } ) ;
177177
178178 }
@@ -186,14 +186,20 @@ private static BuildScript DownloadDotNet(IAutobuilder<AutobuildOptionsShared> b
186186 ///
187187 /// See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script.
188188 /// </summary>
189- private static BuildScript DownloadDotNetVersion ( IAutobuilder < AutobuildOptionsShared > builder , string path , string version )
189+ private static BuildScript DownloadDotNetVersion ( IAutobuilder < AutobuildOptionsShared > builder , string path , string version , bool checkInstalledSdkVersion = true )
190190 {
191- return BuildScript . Bind ( GetInstalledSdksScript ( builder . Actions ) , ( sdks , sdksRet ) =>
191+ var firstScript = checkInstalledSdkVersion
192+ ? GetInstalledSdksScript ( builder . Actions )
193+ : BuildScript . Success ;
194+
195+ return BuildScript . Bind ( firstScript , ( sdks , sdksRet ) =>
192196 {
193- if ( sdksRet == 0 && sdks . Count == 1 && sdks [ 0 ] . StartsWith ( version + " " , StringComparison . Ordinal ) )
197+ if ( checkInstalledSdkVersion && sdksRet == 0 && sdks . Count == 1 && sdks [ 0 ] . StartsWith ( version + " " , StringComparison . Ordinal ) )
198+ {
194199 // The requested SDK is already installed (and no other SDKs are installed), so
195200 // no need to reinstall
196201 return BuildScript . Failure ;
202+ }
197203
198204 builder . Log ( Severity . Info , "Attempting to download .NET Core {0}" , version ) ;
199205
0 commit comments