This repository was archived by the owner on Nov 20, 2023. It is now read-only.
File tree 1 file changed +10
-1
lines changed
src/Microsoft.Tye.Core/ConfigModel
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
5
+ using System ;
5
6
using System . Collections . Generic ;
6
7
using System . IO ;
7
8
using Microsoft . Tye . Serialization ;
@@ -68,7 +69,7 @@ private static ConfigApplication FromSolution(FileInfo file)
68
69
// We want a *fast* heuristic that excludes unit test projects and class libraries without
69
70
// having to load all of the projects.
70
71
var launchSettings = Path . Combine ( projectFile . DirectoryName , "Properties" , "launchSettings.json" ) ;
71
- if ( File . Exists ( launchSettings ) )
72
+ if ( File . Exists ( launchSettings ) || ContainsOutputTypeExe ( projectFile ) )
72
73
{
73
74
var service = new ConfigService ( )
74
75
{
@@ -83,6 +84,14 @@ private static ConfigApplication FromSolution(FileInfo file)
83
84
return application ;
84
85
}
85
86
87
+ private static bool ContainsOutputTypeExe ( FileInfo projectFile )
88
+ {
89
+ // Note, this will not work if OutputType is on separate lines.
90
+ // TODO consider a more thorough check with xml reading, but at that point, it may be better just to read the project itself.
91
+ var content = File . ReadAllText ( projectFile . FullName ) ;
92
+ return content . Contains ( "<OutputType>exe</OutputType>" , StringComparison . OrdinalIgnoreCase ) ;
93
+ }
94
+
86
95
private static ConfigApplication FromYaml ( FileInfo file )
87
96
{
88
97
using var parser = new YamlParser ( file ) ;
You can’t perform that action at this time.
0 commit comments