diff --git a/src/Microsoft.DotNet.Watcher.Tools/Microsoft.DotNet.Watcher.Tools.nuspec b/src/Microsoft.DotNet.Watcher.Tools/Microsoft.DotNet.Watcher.Tools.nuspec index 259eaa5cfb..74300b89ea 100644 --- a/src/Microsoft.DotNet.Watcher.Tools/Microsoft.DotNet.Watcher.Tools.nuspec +++ b/src/Microsoft.DotNet.Watcher.Tools/Microsoft.DotNet.Watcher.Tools.nuspec @@ -23,8 +23,9 @@ - - + + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Watcher.Tools/project.json b/src/Microsoft.DotNet.Watcher.Tools/project.json index 804dcd5b4e..502c402f2e 100644 --- a/src/Microsoft.DotNet.Watcher.Tools/project.json +++ b/src/Microsoft.DotNet.Watcher.Tools/project.json @@ -23,6 +23,11 @@ } } }, + "publishOptions": { + "include": [ + "tools/*.targets" + ] + }, "dependencies": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.Extensions.CommandLineUtils": "1.1.0-*", diff --git a/src/Microsoft.Extensions.Caching.SqlConfig.Tools/Microsoft.Extensions.Caching.SqlConfig.Tools.nuspec b/src/Microsoft.Extensions.Caching.SqlConfig.Tools/Microsoft.Extensions.Caching.SqlConfig.Tools.nuspec index 82ab8374f4..4b56ae8719 100644 --- a/src/Microsoft.Extensions.Caching.SqlConfig.Tools/Microsoft.Extensions.Caching.SqlConfig.Tools.nuspec +++ b/src/Microsoft.Extensions.Caching.SqlConfig.Tools/Microsoft.Extensions.Caching.SqlConfig.Tools.nuspec @@ -23,7 +23,8 @@ - - + + + \ No newline at end of file diff --git a/src/Microsoft.Extensions.SecretManager.Tools/Microsoft.Extensions.SecretManager.Tools.nuspec b/src/Microsoft.Extensions.SecretManager.Tools/Microsoft.Extensions.SecretManager.Tools.nuspec index db6cb0bf93..ac4bfbfe7b 100644 --- a/src/Microsoft.Extensions.SecretManager.Tools/Microsoft.Extensions.SecretManager.Tools.nuspec +++ b/src/Microsoft.Extensions.SecretManager.Tools/Microsoft.Extensions.SecretManager.Tools.nuspec @@ -26,7 +26,8 @@ - - + + + \ No newline at end of file diff --git a/src/Microsoft.Extensions.SecretManager.Tools/project.json b/src/Microsoft.Extensions.SecretManager.Tools/project.json index 7fa5af3662..79b230a15f 100644 --- a/src/Microsoft.Extensions.SecretManager.Tools/project.json +++ b/src/Microsoft.Extensions.SecretManager.Tools/project.json @@ -29,6 +29,11 @@ } } }, + "publishOptions": { + "include": [ + "*.targets" + ] + }, "dependencies": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.Extensions.CommandLineUtils": "1.1.0-*", diff --git a/tools/NuGetPackager/PackCommand.cs b/tools/NuGetPackager/PackCommand.cs index 687d0e0d64..fd76e86692 100644 --- a/tools/NuGetPackager/PackCommand.cs +++ b/tools/NuGetPackager/PackCommand.cs @@ -29,15 +29,31 @@ namespace NuGetPackager public async Task PackAsync(string nuspec, string config, string outputDir) { var project = ProjectContext.Create(Path.GetDirectoryName(nuspec), FrameworkConstants.CommonFrameworks.NetCoreApp10); - var props = "configuration=" + config; var idx = 0; + var props = ""; + var first = false; foreach (var depVersion in GetDependencies(project).OrderBy(p => p.Item1).Select(p => p.Item2)) { - props += $";dep_{++idx}={depVersion}"; - } + if (first) + { + first = false; + } + else + { + props += ";"; + } - var buildCommand = Command.CreateDotNet("build", - new[] { project.ProjectFile.ProjectFilePath, "--configuration", config }, + props += $"dep_{++idx}={depVersion}"; + } + var publishDir = Path.Combine(Directory.GetCurrentDirectory(), "artifacts/build", project.ProjectFile.Name); + if (Directory.Exists(publishDir)) + { + Directory.Delete(publishDir, recursive: true); + } + Directory.CreateDirectory(publishDir); + + var buildCommand = Command.CreateDotNet("publish", + new[] { project.ProjectFile.ProjectFilePath, "--configuration", config, "--output", publishDir }, configuration: config); if (buildCommand.Execute().ExitCode != 0) @@ -53,7 +69,8 @@ namespace NuGetPackager "-Verbosity", "detailed", "-OutputDirectory", outputDir, "-Version", version, - "-Properties", props); + "-Properties", props, + "-BasePath", publishDir); } private IEnumerable> GetDependencies(ProjectContext context) @@ -136,7 +153,7 @@ namespace NuGetPackager } Console.WriteLine("log : Downloading nuget.exe 3.5.0-rc1".Bold().Black()); - + var response = await new HttpClient().GetAsync("https://dist.nuget.org/win-x86-commandline/v3.5.0-rc1/NuGet.exe"); using (var file = new FileStream(nugetPath, FileMode.CreateNew)) {