File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 22// The .NET Foundation licenses this file to you under the MIT license.
33
44using System . CommandLine . Parsing ;
5- using System . Globalization ;
5+ using System . Security . Cryptography ;
6+ using System . Text ;
67using Aspire . Cli . Configuration ;
78using Aspire . Cli . DotNet ;
89using Aspire . Cli . Interaction ;
@@ -31,10 +32,11 @@ protected override string CreateDefaultOutputPath(ArgumentResult result)
3132 var projectFile = result . GetValue < FileInfo ? > ( "--project" ) ;
3233 var sourcePath = projectFile ? . FullName ?? Environment . CurrentDirectory ;
3334
34- // Create a stable hash of the source path for the directory name
35- var sourceHash = sourcePath . GetHashCode ( ) . ToString ( "x8" , CultureInfo . InvariantCulture ) ;
35+ // Create a stable hash of the source path for the directory name using SHA256
36+ var sourceHash = SHA256 . HashData ( Encoding . UTF8 . GetBytes ( sourcePath ) ) ;
37+ var hashString = Convert . ToHexString ( sourceHash ) [ ..8 ] . ToLowerInvariant ( ) ;
3638
37- return Directory . CreateTempSubdirectory ( $ "aspire-deploy-{ sourceHash } -") . FullName ;
39+ return Directory . CreateTempSubdirectory ( $ "aspire-deploy-{ hashString } -") . FullName ;
3840 }
3941
4042 protected override string [ ] GetRunArguments ( string fullyQualifiedOutputPath , string [ ] unmatchedTokens ) =>
You can’t perform that action at this time.
0 commit comments