From edff3a563ce270f2965ceaf9b3f23bfd982a5846 Mon Sep 17 00:00:00 2001 From: moozzyk Date: Tue, 9 Feb 2016 10:19:38 -0800 Subject: [PATCH] Adding messages showing that the tool is running --- src/dotnet-publish-iis/Program.cs | 16 ++++++++++------ src/dotnet-publish-iis/PublishIISCommand.cs | 7 +++++++ src/dotnet-publish-iis/project.json | 3 ++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/dotnet-publish-iis/Program.cs b/src/dotnet-publish-iis/Program.cs index 45a599b845..9d00b0104b 100644 --- a/src/dotnet-publish-iis/Program.cs +++ b/src/dotnet-publish-iis/Program.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.DotNet.Cli.Utils; using Microsoft.Extensions.CommandLineUtils; namespace Microsoft.AspNetCore.Tools.PublishIIS @@ -32,7 +33,13 @@ namespace Microsoft.AspNetCore.Tools.PublishIIS return 2; } - return new PublishIISCommand(publishFolder, projectPath.Value, webRootOption.Value()).Run(); + Reporter.Output.WriteLine($"Configuring the following project for use with IIS: '{publishFolder}'"); + + var exitCode = new PublishIISCommand(publishFolder, projectPath.Value, webRootOption.Value()).Run(); + + Reporter.Output.WriteLine("Configuring project completed successfully"); + + return exitCode; }); try @@ -41,11 +48,8 @@ namespace Microsoft.AspNetCore.Tools.PublishIIS } catch (Exception e) { -#if DEBUG - Console.Error.WriteLine(e); -#else - Console.Error.WriteLine(e.Message); -#endif + Reporter.Error.WriteLine(e.Message.Red()); + Reporter.Verbose.WriteLine(e.ToString().Yellow()); } return 1; diff --git a/src/dotnet-publish-iis/PublishIISCommand.cs b/src/dotnet-publish-iis/PublishIISCommand.cs index 06c9c34c2b..4b8946d766 100644 --- a/src/dotnet-publish-iis/PublishIISCommand.cs +++ b/src/dotnet-publish-iis/PublishIISCommand.cs @@ -5,6 +5,7 @@ using System; using System.IO; using System.Xml; using System.Xml.Linq; +using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ProjectModel; using Microsoft.Extensions.Configuration; @@ -32,12 +33,18 @@ namespace Microsoft.AspNetCore.Tools.PublishIIS var webConfigPath = Path.Combine(_publishFolder, webRoot, "web.config"); if (File.Exists(webConfigPath)) { + Reporter.Output.WriteLine($"Updating web.config at '{webConfigPath}'"); + try { webConfigXml = XDocument.Load(webConfigPath); } catch (XmlException) { } } + else + { + Reporter.Output.WriteLine($"No web.config found. Creating '{webConfigPath}'"); + } var applicationName = Path.ChangeExtension(GetApplicationName(applicationBasePath), "exe"); var transformedConfig = WebConfigTransform.Transform(webConfigXml, applicationName, ConfigureForAzure()); diff --git a/src/dotnet-publish-iis/project.json b/src/dotnet-publish-iis/project.json index 4a99f9f0f0..1602b130ee 100644 --- a/src/dotnet-publish-iis/project.json +++ b/src/dotnet-publish-iis/project.json @@ -11,7 +11,8 @@ "NETStandard.Library": "1.0.0-*", "Microsoft.Extensions.CommandLineUtils": "1.0.0-*", "Microsoft.Extensions.Configuration.Json": "1.0.0-*", - "Microsoft.DotNet.ProjectModel": "1.0.0-*" + "Microsoft.DotNet.ProjectModel": "1.0.0-*", + "Microsoft.DotNet.Cli.Utils": "1.0.0-*" }, "frameworks": {