private static ConfigApplication FromSolution(FileInfo file) { var application = new ConfigApplication() { Source = file, Name = NameInferer.InferApplicationName(file) }; // BE CAREFUL modifying this code. Avoid proliferating MSBuild types // throughout the code, because we load them dynamically. foreach (var projectFile in ProjectReader.EnumerateProjects(file)) { // Check for the existance of a launchSettings.json as an indication that the project is // runnable. This will only apply in the case where tye is being used against a solution // like `tye init` or `tye run` without a `tye.yaml`. // // 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) || ContainsOutputTypeExe(projectFile)) { var service = new ConfigService() { Name = NormalizeServiceName(Path.GetFileNameWithoutExtension(projectFile.Name)), Project = projectFile.FullName.Replace('\\', '/'), }; application.Services.Add(service); } } return(application); }
private static ConfigApplication FromProject(FileInfo file) { var application = new ConfigApplication() { Source = file, Name = NameInferer.InferApplicationName(file) }; var service = new ConfigService() { Name = NormalizeServiceName(Path.GetFileNameWithoutExtension(file.Name)), Project = file.FullName.Replace('\\', '/'), }; application.Services.Add(service); return(application); }