Browse Source

Check for output type exe (#459)

pull/465/head release/0.2
Justin Kotalik 6 years ago
committed by GitHub
parent
commit
bf3bc0913b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/Microsoft.Tye.Core/ConfigModel/ConfigFactory.cs

11
src/Microsoft.Tye.Core/ConfigModel/ConfigFactory.cs

@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Tye.Serialization;
@ -68,7 +69,7 @@ namespace Microsoft.Tye.ConfigModel
// We want a *fast* heuristic that excludes unit test projects and class libraries without
// having to load all of the projects.
var launchSettings = Path.Combine(projectFile.DirectoryName, "Properties", "launchSettings.json");
if (File.Exists(launchSettings))
if (File.Exists(launchSettings) || ContainsOutputTypeExe(projectFile))
{
var service = new ConfigService()
{
@ -83,6 +84,14 @@ namespace Microsoft.Tye.ConfigModel
return application;
}
private static bool ContainsOutputTypeExe(FileInfo projectFile)
{
// Note, this will not work if OutputType is on separate lines.
// TODO consider a more thorough check with xml reading, but at that point, it may be better just to read the project itself.
var content = File.ReadAllText(projectFile.FullName);
return content.Contains("<OutputType>exe</OutputType>", StringComparison.OrdinalIgnoreCase);
}
private static ConfigApplication FromYaml(FileInfo file)
{
using var parser = new YamlParser(file);

Loading…
Cancel
Save