From aa3662b4648dfdbab13870de9445427e69e2605d Mon Sep 17 00:00:00 2001 From: David Fowler Date: Mon, 6 Apr 2020 09:59:44 -0700 Subject: [PATCH] Assume using the WebSDK means ASP.NET Core (#302) - Ran into a strange case where some properties weren't being set (need to see if that means the right targets aren't running on the first pass). This was in a 2.1 application. --- src/Microsoft.Tye.Core/ProjectReader.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Tye.Core/ProjectReader.cs b/src/Microsoft.Tye.Core/ProjectReader.cs index b90ea633..093bf3a3 100644 --- a/src/Microsoft.Tye.Core/ProjectReader.cs +++ b/src/Microsoft.Tye.Core/ProjectReader.cs @@ -228,9 +228,17 @@ namespace Microsoft.Tye project.Frameworks.AddRange(sharedFrameworks.Select(s => new Framework(s))); output.WriteDebugLine($"Found shared frameworks: {string.Join(", ", sharedFrameworks)}"); + bool PropertyIsTrue(string property) + { + return projectInstance.GetPropertyValue(property) is string s && !string.IsNullOrEmpty(s) && bool.Parse(s); + } + project.IsAspNet = project.Frameworks.Any(f => f.Name == "Microsoft.AspNetCore.App") || projectInstance.GetPropertyValue("MicrosoftNETPlatformLibrary") == "Microsoft.AspNetCore.App" || - projectInstance.GetPropertyValue("_AspNetCoreAppSharedFxIsEnabled") is string s && !string.IsNullOrEmpty(s) && bool.Parse(s); + PropertyIsTrue("_AspNetCoreAppSharedFxIsEnabled") || + PropertyIsTrue("UsingMicrosoftNETSdkWeb"); + + output.WriteDebugLine($"IsAspNet={project.IsAspNet}"); output.WriteDebugLine($"Evaluation Took: {sw.Elapsed.TotalMilliseconds}ms");