@@ -172,7 +172,7 @@ private static BuildScript DownloadDotNet(IAutobuilder<AutobuildOptionsShared> b
172
172
173
173
const string latestDotNetSdkVersion = "8.0.101" ;
174
174
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 ) ;
176
176
} ) ;
177
177
178
178
}
@@ -186,14 +186,20 @@ private static BuildScript DownloadDotNet(IAutobuilder<AutobuildOptionsShared> b
186
186
///
187
187
/// See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script.
188
188
/// </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 )
190
190
{
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 ) =>
192
196
{
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
+ {
194
199
// The requested SDK is already installed (and no other SDKs are installed), so
195
200
// no need to reinstall
196
201
return BuildScript . Failure ;
202
+ }
197
203
198
204
builder . Log ( Severity . Info , "Attempting to download .NET Core {0}" , version ) ;
199
205
0 commit comments