Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorMatt Ward <matt.ward@microsoft.com>2018-04-13 14:52:09 +0300
committerMatt Ward <matt.ward@microsoft.com>2018-04-13 14:52:09 +0300
commit659f89b525421d177faa3f261cbe9c98dfe7830e (patch)
tree3151c35ea59b07f78b45b6253f3df462c45f2945 /main
parent6ae1dae4a3b9c058ac4bc2c3a7ecd374ad5a8571 (diff)
[AspNetCore] Fix browser not run for ASP.NET Core 2.1 project
The .NET Core SDK 2.1 preview 2 project templates for ASP.NET Core now specify the https and http urls in the launchSettings.json file in the applicationUrl property. Previously this was defined in the ASPNETCORE_URLS environment variable. The full applicationUrl property was being used unmodified and resulted in an invalid url being used so the AspNetCoreExecutionHandler was logging a warning and not opening the browser. Now the first url in the applicationUrl is used if there are multiple urls.
Diffstat (limited to 'main')
-rw-r--r--main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreRunConfiguration.cs12
1 files changed, 10 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreRunConfiguration.cs b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreRunConfiguration.cs
index 11c3e1af7a..5c61419020 100644
--- a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreRunConfiguration.cs
+++ b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore/AspNetCoreRunConfiguration.cs
@@ -72,10 +72,10 @@ namespace MonoDevelop.AspNetCore
{
var applicationUrl = settings?.GetValue ("applicationUrl")?.Value<string> ();
if (applicationUrl != null)
- return applicationUrl;
+ return GetFirstUrl (applicationUrl);
if (environmentVariables.TryGetValue ("ASPNETCORE_URLS", out string applicationUrls)) {
- applicationUrl = applicationUrls.Split (';').FirstOrDefault ();
+ applicationUrl = GetFirstUrl (applicationUrls);
if (applicationUrl != null)
return applicationUrl;
}
@@ -83,6 +83,14 @@ namespace MonoDevelop.AspNetCore
return "http://localhost:5000";
}
+ static string GetFirstUrl (string url)
+ {
+ if (string.IsNullOrEmpty (url) || !url.Contains (';'))
+ return url;
+
+ return url.Split (';').FirstOrDefault ();
+ }
+
protected override void Read (IPropertySet pset)
{
base.Read (pset);