diff --git a/Binaries/NuGet.exe b/Binaries/NuGet.exe new file mode 100644 index 0000000..f81a503 Binary files /dev/null and b/Binaries/NuGet.exe differ diff --git a/DotNetBuilder/MicroBuildServer.DotNetBuilder.csproj b/DotNetBuilder/MicroBuildServer.DotNetBuilder.csproj index 4090f91..0d8835b 100644 --- a/DotNetBuilder/MicroBuildServer.DotNetBuilder.csproj +++ b/DotNetBuilder/MicroBuildServer.DotNetBuilder.csproj @@ -60,12 +60,24 @@ ..\packages\Microsoft.Extensions.CommandLineUtils.1.1.0\lib\net451\Microsoft.Extensions.CommandLineUtils.dll True + + ..\packages\Microsoft.VisualStudio.Setup.Configuration.Interop.1.8.24\lib\net35\Microsoft.VisualStudio.Setup.Configuration.Interop.dll + True + + + ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll + True + ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NuGet.CommandLine.3.5.0\tools\NuGet.exe + + ..\Binaries\NuGet.exe + + + ..\packages\NuGet.Build.Tasks.4.0.0\lib\net45\NuGet.Build.Tasks.dll + True ..\packages\NuGet.Client.4.0.0\lib\net45\NuGet.Client.dll @@ -77,7 +89,6 @@ ..\packages\NuGet.Common.4.0.0\lib\net45\NuGet.Common.dll - True ..\packages\NuGet.Configuration.4.0.0\lib\net45\NuGet.Configuration.dll @@ -87,6 +98,10 @@ ..\packages\NuGet.ContentModel.4.0.0\lib\net45\NuGet.ContentModel.dll True + + ..\packages\NuGet.Core.2.14.0\lib\net40-Client\NuGet.Core.dll + True + ..\packages\NuGet.DependencyResolver.Core.4.0.0\lib\net45\NuGet.DependencyResolver.Core.dll True @@ -99,6 +114,10 @@ ..\packages\NuGet.LibraryModel.4.0.0\lib\net45\NuGet.LibraryModel.dll True + + ..\packages\NuGet.PackageManagement.4.0.0\lib\net45\NuGet.PackageManagement.dll + True + ..\packages\NuGet.Packaging.4.0.0\lib\net45\NuGet.Packaging.dll True @@ -111,6 +130,10 @@ ..\packages\NuGet.Packaging.Core.Types.4.0.0\lib\net45\NuGet.Packaging.Core.Types.dll True + + ..\packages\NuGet.ProjectManagement.4.0.0\lib\net45\NuGet.ProjectManagement.dll + True + ..\packages\NuGet.ProjectModel.4.0.0\lib\net45\NuGet.ProjectModel.dll True @@ -127,6 +150,10 @@ ..\packages\NuGet.Repositories.4.0.0\lib\net45\NuGet.Repositories.dll True + + ..\packages\NuGet.Resolver.4.0.0\lib\net45\NuGet.Resolver.dll + True + ..\packages\NuGet.RuntimeModel.4.0.0\lib\net45\NuGet.RuntimeModel.dll True @@ -167,6 +194,7 @@ ..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True + diff --git a/DotNetBuilder/NuGetter.cs b/DotNetBuilder/NuGetter.cs index 1dca33a..d968788 100644 --- a/DotNetBuilder/NuGetter.cs +++ b/DotNetBuilder/NuGetter.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Security; -using NuGet; using NuGet.CommandLine; using NuGet.Common; @@ -10,111 +7,117 @@ namespace MicroBuildServer.DotNetBuilder { static class NuGetter { - private class Console : IConsole + private class Console : NuGet.CommandLine.IConsole, NuGet.Common.ILogger { public readonly Messages Messages = new Messages(); - public int CursorLeft + int IConsole.CursorLeft { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } - public bool IsNonInteractive + bool IConsole.IsNonInteractive { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } - public Verbosity Verbosity + Verbosity IConsole.Verbosity { get { return Verbosity.Detailed; } set { throw new NotImplementedException(); } } - public int WindowWidth + int IConsole.WindowWidth { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } - public bool Confirm(string description) + bool IConsole.Confirm(string description) { throw new NotImplementedException(); } - public void LogDebug(string data) => this.Messages.Add(Message.CreateInfo(data)); - - public void LogError(string data) => this.Messages.Add(Message.CreateError(data)); - - public void LogErrorSummary(string data) => this.Messages.Add(Message.CreateError(data)); - - public void LogInformation(string data) => this.Messages.Add(Message.CreateInfo(data)); - - public void LogInformationSummary(string data) => this.Messages.Add(Message.CreateInfo(data)); - - public void LogMinimal(string data) => this.Messages.Add(Message.CreateInfo(data)); - - public void LogVerbose(string data) => this.Messages.Add(Message.CreateInfo(data)); - - public void LogWarning(string data) => this.Messages.Add(Message.CreateWarn(data)); - - public void PrintJustified(int startIndex, string text) + void IConsole.PrintJustified(int startIndex, string text) { throw new NotImplementedException(); } - public void PrintJustified(int startIndex, string text, int maxWidth) + void IConsole.PrintJustified(int startIndex, string text, int maxWidth) { throw new NotImplementedException(); } - public ConsoleKeyInfo ReadKey() + ConsoleKeyInfo IConsole.ReadKey() { throw new NotImplementedException(); } - public string ReadLine() + string IConsole.ReadLine() { throw new NotImplementedException(); } - public void ReadSecureString(SecureString secureString) + void IConsole.ReadSecureString(SecureString secureString) { throw new NotImplementedException(); } - public void Write(string value) => this.Messages.Add(Message.CreateInfo(value)); + void IConsole.Write(string value) => this.WriteInfo(value); - public void Write(object value) => this.Write(value.ToString()); + void IConsole.Write(object value) => this.WriteInfo(value.ToString()); - public void Write(string format, params object[] args) => this.Write(string.Format(format, args)); + void IConsole.Write(string format, params object[] args) => this.WriteInfo(string.Format(format, args)); - public void WriteError(string value) => this.Messages.Add(Message.CreateError(value)); + void IConsole.WriteError(string value) => this.WriteError(value); - public void WriteError(object value) => this.WriteError(value.ToString()); + void IConsole.WriteError(object value) => this.WriteError(value.ToString()); - public void WriteError(string format, params object[] args) => this.WriteError(string.Format(format, args)); + void IConsole.WriteError(string format, params object[] args) => this.WriteError(string.Format(format, args)); - public void WriteLine() + void IConsole.WriteLine() { } - public void WriteLine(string value) => this.Write(value); + void IConsole.WriteLine(string value) => this.WriteInfo(value); - public void WriteLine(object value) => this.Write(value); + void IConsole.WriteLine(object value) => this.WriteInfo(value.ToString()); - public void WriteLine(string format, params object[] args) => this.Write(format, args); + void IConsole.WriteLine(string format, params object[] args) => this.WriteInfo(string.Format(format, args)); - public void WriteLine(ConsoleColor color, string value, params object[] args) => this.Write(value, args); + void IConsole.WriteLine(ConsoleColor color, string value, params object[] args) => this.WriteInfo(string.Format(value, args)); - public void WriteWarning(string value) => this.Messages.Add(Message.CreateWarn(value)); + void IConsole.WriteWarning(string value) => this.WriteWarning(value); + + void IConsole.WriteWarning(string value, params object[] args) => this.WriteWarning(string.Format(value, args)); + + void IConsole.WriteWarning(bool prependWarningText, string value) => this.WriteWarning(value); - public void WriteWarning(string value, params object[] args) => this.WriteWarning(string.Format(value, args)); + void IConsole.WriteWarning(bool prependWarningText, string value, params object[] args) => this.WriteWarning(string.Format(value, args)); - public void WriteWarning(bool prependWarningText, string value) => this.WriteWarning(value); + void ILogger.LogDebug(string data) => this.WriteInfo(data); - public void WriteWarning(bool prependWarningText, string value, params object[] args) => this.WriteWarning(value, args); + void ILogger.LogError(string data) => this.WriteError(data); + + void ILogger.LogErrorSummary(string data) => this.WriteError(data); + + void ILogger.LogInformation(string data) => this.WriteInfo(data); + + void ILogger.LogInformationSummary(string data) => this.WriteInfo(data); + + void ILogger.LogMinimal(string data) => this.WriteInfo(data); + + void ILogger.LogVerbose(string data) => this.WriteInfo(data); + + void ILogger.LogWarning(string data) => this.WriteWarning(data); + + public void WriteInfo(string value) => this.Messages.Add(Message.CreateInfo(value)); + + public void WriteWarning(string value) => this.Messages.Add(Message.CreateWarn(value)); + + public void WriteError(string value) => this.Messages.Add(Message.CreateError(value)); } public static Response Pack(NuGetPackRequest request) @@ -126,6 +129,7 @@ namespace MicroBuildServer.DotNetBuilder OutputDirectory = PathTools.OptimizePath(request.OutputDirectory), Version = request.Version, Console = console, + CurrentDirectory = request.BaseDirectory, Verbosity = Verbosity.Detailed, }; command.Arguments.Add(request.SpecPath); @@ -136,7 +140,7 @@ namespace MicroBuildServer.DotNetBuilder } catch (Exception e) { - console.WriteError(e); + console.WriteError(e.ToString()); } return new Response(console.Messages); @@ -160,7 +164,7 @@ namespace MicroBuildServer.DotNetBuilder } catch (Exception e) { - console.WriteError(e); + console.WriteError(e.ToString()); } return new Response(console.Messages); @@ -169,10 +173,10 @@ namespace MicroBuildServer.DotNetBuilder public static Response Restore(NuGetRestoreRequest request) { var console = new Console(); - PackageBuilder builder = new PackageBuilder(); var command = new RestoreCommand { Console = console, + CurrentDirectory = request.BaseDirectory, Verbosity = Verbosity.Detailed, }; command.Arguments.Add(request.SolutionPath); @@ -183,7 +187,7 @@ namespace MicroBuildServer.DotNetBuilder } catch (Exception e) { - console.WriteError(e); + console.WriteError(e.ToString()); } return new Response(console.Messages); diff --git a/DotNetBuilder/app.config b/DotNetBuilder/app.config index 448d8e7..1525d22 100644 --- a/DotNetBuilder/app.config +++ b/DotNetBuilder/app.config @@ -30,6 +30,14 @@ + + + + + + + + diff --git a/DotNetBuilder/packages.config b/DotNetBuilder/packages.config index 5836334..6cd7cf7 100644 --- a/DotNetBuilder/packages.config +++ b/DotNetBuilder/packages.config @@ -6,23 +6,29 @@ + + + - + + + +