@@ -231,9 +231,32 @@ public static string DeterminePublishLocation(string workingDirectory, string pr
231
231
return path ;
232
232
}
233
233
234
- public static void ValidateMicrosoftAspNetCoreAllReference ( IToolLogger logger , string csprofPath )
234
+ public static void ValidateMicrosoftAspNetCoreAllReference ( IToolLogger logger , string csprofPath , out string manifestContent )
235
235
{
236
- if ( Directory . Exists ( csprofPath ) )
236
+ if ( ! string . IsNullOrEmpty ( Environment . GetEnvironmentVariable ( Constants . ENV_DOTNET_LAMBDA_CLI_LOCAL_MANIFEST_OVERRIDE ) ) )
237
+ {
238
+ var filePath = Environment . GetEnvironmentVariable ( Constants . ENV_DOTNET_LAMBDA_CLI_LOCAL_MANIFEST_OVERRIDE ) ;
239
+ if ( File . Exists ( filePath ) )
240
+ {
241
+ logger ? . WriteLine ( $ "Using local manifest override: { filePath } ") ;
242
+ manifestContent = File . ReadAllText ( filePath ) ;
243
+ }
244
+ else
245
+ {
246
+ logger ? . WriteLine ( "Using local manifest override" ) ;
247
+ manifestContent = null ;
248
+ }
249
+ }
250
+ else
251
+ {
252
+ manifestContent = ToolkitConfigFileFetcher . Instance . GetFileContentAsync ( logger , "LambdaPackageStoreManifest.xml" ) . Result ;
253
+ }
254
+ if ( string . IsNullOrEmpty ( manifestContent ) )
255
+ {
256
+ return ;
257
+ }
258
+
259
+ if ( Directory . Exists ( csprofPath ) )
237
260
{
238
261
var projectFiles = Directory . GetFiles ( csprofPath , "*.csproj" , SearchOption . TopDirectoryOnly ) ;
239
262
if ( projectFiles . Length != 1 )
@@ -251,15 +274,8 @@ public static void ValidateMicrosoftAspNetCoreAllReference(IToolLogger logger, s
251
274
252
275
var projectContent = File . ReadAllText ( csprofPath ) ;
253
276
254
- var manifestContent = ToolkitConfigFileFetcher . Instance . GetFileContentAsync ( logger , "LambdaPackageStoreManifest.xml" ) . Result ;
255
- if ( ! string . IsNullOrEmpty ( manifestContent ) )
256
- {
257
- ValidateMicrosoftAspNetCoreAllReference ( logger , manifestContent , projectContent ) ;
258
- }
259
- else
260
- {
261
- logger . WriteLine ( "Skipping Microsoft.AspNetCore.All validation because error while downloading Lambda runtime store manifest." ) ;
262
- }
277
+
278
+ ValidateMicrosoftAspNetCoreAllReference ( logger , manifestContent , projectContent ) ;
263
279
}
264
280
265
281
/// <summary>
@@ -326,11 +342,11 @@ public static void ValidateMicrosoftAspNetCoreAllReference(IToolLogger logger, s
326
342
}
327
343
}
328
344
329
- throw new LambdaToolsException ( $ "Project is referencing version { projectAspNetCoreVersion } of { ASPNET_CORE_ALL } which is newer " +
330
- $ "than { latestLambdaDeployedVersion } , the latest version available in the Lambda Runtime environment. Please update your project to " +
345
+ throw new LambdaToolsException ( $ "Project is referencing version { projectAspNetCoreVersion } of { ASPNET_CORE_ALL } which is newer " +
346
+ $ "than { latestLambdaDeployedVersion } , the latest version available in the Lambda Runtime environment. Please update your project to " +
331
347
$ "use version { latestLambdaDeployedVersion } and then redeploy your Lambda function.", LambdaToolsException . ErrorCode . AspNetCoreAllValidation ) ;
332
348
}
333
- catch ( LambdaToolsException )
349
+ catch ( LambdaToolsException )
334
350
{
335
351
throw ;
336
352
}
0 commit comments