@@ -131,7 +131,7 @@ private async IAsyncEnumerable<DiscoveryResult> FindAllSolutionsAndProjects(stri
131131 /* SLN found no projs */ ( not null , 1 , 0 , _, _, false , _, _) => new DiscoveryResult ( DiscoveryResult . RETURN_SLN_NOPROJ , item , project ) ,
132132 /* SLN found no projs, del */ ( not null , 1 , 0 , _, _, true , _, _) => new DiscoveryResult ( DiscoveryResult . RETURN_GOOD , item , project ) ,
133133 /* Project found */ ( not null , 0 , 1 , _, _, _, _, _) => new DiscoveryResult ( DiscoveryResult . RETURN_GOOD , item , project ) ,
134- /* Single .cs file compile */ ( null , 0 , 0 , 1 , _ , _ , _ , true ) => new DiscoveryResult ( DiscoveryResult . RETURN_GOOD , item , item ) ,
134+ /* Single .cs file compile */ ( not null , 0 , 0 , 1 , _, _, _, true ) => new DiscoveryResult ( DiscoveryResult . RETURN_GOOD , item , project ) ,
135135 /* Code no proj */ ( null , 0 , 0 , > 0 , _, _, _, _) => new DiscoveryResult ( DiscoveryResult . RETURN_NOPROJ , item , "" ) ,
136136 /* Code no proj */ ( null , 0 , 0 , _, > 0 , _, _, _) => new DiscoveryResult ( DiscoveryResult . RETURN_NOPROJ , item , "" ) ,
137137 /* catch all */ _ => new DiscoveryResult ( DiscoveryResult . RETURN_NOPROJ , item , "CONDITION NOT FOUND" ) ,
@@ -231,8 +231,18 @@ static void ScanFile(string file, ref string? project, ref int countOfSln, ref i
231231
232232 // If a code file
233233 else if ( EnvExtensionsCodeTriggers . Contains ( ext , StringComparer . OrdinalIgnoreCase ) )
234+ {
234235 countOfCode ++ ;
235236
237+ // Case for .NET 10 single file app
238+ // No solution or projects found, process a C# file
239+ if ( countOfSln == 0 && countOfProjs == 0 && ext . Equals ( ".cs" , StringComparison . OrdinalIgnoreCase ) )
240+ {
241+ // First code file can be a project, anything else is invalid
242+ project = countOfCode == 1 ? file : null ;
243+ }
244+ }
245+
236246 // If a special trigger file
237247 else if ( EnvFileTriggers . Contains ( Path . GetFileName ( file ) , StringComparer . OrdinalIgnoreCase ) )
238248 countOfSpecial ++ ;
0 commit comments