diff --git a/src/dotnet/commands/dotnet-pack/LocalizableStrings.resx b/src/dotnet/commands/dotnet-pack/LocalizableStrings.resx
index d297d15e2..58ac50f04 100644
--- a/src/dotnet/commands/dotnet-pack/LocalizableStrings.resx
+++ b/src/dotnet/commands/dotnet-pack/LocalizableStrings.resx
@@ -130,7 +130,7 @@
Directory in which to place built packages.
- Skip building the project prior to packing. By default, the project will be built.
+ Do not build project before packing. Implies --no-restore.Include packages with symbols in addition to regular packages in output directory.
diff --git a/src/dotnet/commands/dotnet-pack/PackCommand.cs b/src/dotnet/commands/dotnet-pack/PackCommand.cs
index a781fe254..6aa36b73e 100644
--- a/src/dotnet/commands/dotnet-pack/PackCommand.cs
+++ b/src/dotnet/commands/dotnet-pack/PackCommand.cs
@@ -43,7 +43,7 @@ namespace Microsoft.DotNet.Tools.Pack
msbuildArgs.AddRange(parsedPack.Arguments);
- bool noRestore = parsedPack.HasOption("--no-restore");
+ bool noRestore = parsedPack.HasOption("--no-restore") || parsedPack.HasOption("--no-build");
return new PackCommand(
msbuildArgs,
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.cs.xlf
index 85c8ccece..e47c9374d 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.cs.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.cs.xlf
@@ -23,8 +23,8 @@
-
- Přeskočí sestavení projektu, dokud ho nezabalíte. Projekt se sestaví automaticky.
+
+ Přeskočí sestavení projektu, dokud ho nezabalíte. Projekt se sestaví automaticky.
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.de.xlf
index 9a72dc7b1..f17726346 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.de.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.de.xlf
@@ -23,8 +23,8 @@
-
- Hiermit wird das Projekt nicht vor dem Packen erstellt. Standardmäßig wird das Projekt erstellt.
+
+ Hiermit wird das Projekt nicht vor dem Packen erstellt. Standardmäßig wird das Projekt erstellt.
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.es.xlf
index 46223a4b2..571c84f60 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.es.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.es.xlf
@@ -23,8 +23,8 @@
-
- Omita la compilación del proyecto antes de empaquetar. El proyecto se compilará de manera predeterminada.
+
+ Omita la compilación del proyecto antes de empaquetar. El proyecto se compilará de manera predeterminada.
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.fr.xlf
index e30934547..63e283824 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.fr.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.fr.xlf
@@ -23,8 +23,8 @@
-
- Ignorez la génération du projet avant la compression. Par défaut, le projet est généré.
+
+ Ignorez la génération du projet avant la compression. Par défaut, le projet est généré.
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.it.xlf
index d6fde8790..719bb384b 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.it.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.it.xlf
@@ -23,8 +23,8 @@
-
- Consente di ignorare la compilazione del progetto prima di creare il pacchetto. Per impostazione predefinita, il progetto verrà compilato.
+
+ Consente di ignorare la compilazione del progetto prima di creare il pacchetto. Per impostazione predefinita, il progetto verrà compilato.
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ja.xlf
index 32500da1a..274d56557 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ja.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ja.xlf
@@ -23,8 +23,8 @@
-
- パッキングの前に、プロジェクトの構築をスキップします。既定では、プロジェクトは構築されます。
+
+ パッキングの前に、プロジェクトの構築をスキップします。既定では、プロジェクトは構築されます。
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ko.xlf
index 134bb3f08..be5531232 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ko.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ko.xlf
@@ -23,8 +23,8 @@
-
- 압축하기 전에 프로젝트를 빌드하지 않습니다. 기본적으로 프로젝트가 빌드됩니다.
+
+ 압축하기 전에 프로젝트를 빌드하지 않습니다. 기본적으로 프로젝트가 빌드됩니다.
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.pl.xlf
index 65a8a64ab..5f1d77a40 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.pl.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.pl.xlf
@@ -23,8 +23,8 @@
-
- Pomiń kompilację projektu przed pakowaniem. Domyślnie projekt zostanie skompilowany.
+
+ Pomiń kompilację projektu przed pakowaniem. Domyślnie projekt zostanie skompilowany.
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.pt-BR.xlf
index fd7dd4b59..e360f927b 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.pt-BR.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.pt-BR.xlf
@@ -23,8 +23,8 @@
-
- Ignorar a compilação do projeto antes do empacotamento. Por padrão, o projeto será compilado.
+
+ Ignorar a compilação do projeto antes do empacotamento. Por padrão, o projeto será compilado.
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ru.xlf
index 36c29f987..f8fdb23d3 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ru.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.ru.xlf
@@ -23,8 +23,8 @@
-
- Пропуск сборки проекта перед упаковкой. По умолчанию выполняется сборка проекта.
+
+ Пропуск сборки проекта перед упаковкой. По умолчанию выполняется сборка проекта.
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.tr.xlf
index 0e6d13a56..87e5239d2 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.tr.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.tr.xlf
@@ -23,8 +23,8 @@
-
- Projeyi paketlemeden önce derlemeyi atlayın. Varsayılan olarak, proje derlenir.
+
+ Projeyi paketlemeden önce derlemeyi atlayın. Varsayılan olarak, proje derlenir.
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.zh-Hans.xlf
index e45821421..67c059863 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.zh-Hans.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.zh-Hans.xlf
@@ -23,8 +23,8 @@
-
- 在打包之前跳过生成项目。默认情况下,将生成项目。
+
+ 在打包之前跳过生成项目。默认情况下,将生成项目。
diff --git a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.zh-Hant.xlf
index 4f8d86032..f51450f97 100644
--- a/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.zh-Hant.xlf
+++ b/src/dotnet/commands/dotnet-pack/xlf/LocalizableStrings.zh-Hant.xlf
@@ -23,8 +23,8 @@
-
- 在封裝前跳過建置專案。預設會建置專案。
+
+ 在封裝前跳過建置專案。預設會建置專案。
diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/CommandResultAssertions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/CommandResultAssertions.cs
index f8317f34a..bdb460302 100644
--- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/CommandResultAssertions.cs
+++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/CommandResultAssertions.cs
@@ -69,6 +69,13 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
return new AndConstraint(this);
}
+ public AndConstraint NotHaveStdOutContaining(string pattern)
+ {
+ Execute.Assertion.ForCondition(!_commandResult.StdOut.Contains(pattern))
+ .FailWith(AppendDiagnosticsTo($"The command output contained a result it should not have contained: {pattern}{Environment.NewLine}"));
+ return new AndConstraint(this);
+ }
+
public AndConstraint HaveStdOutMatching(string pattern, RegexOptions options = RegexOptions.None)
{
Execute.Assertion.ForCondition(Regex.Match(_commandResult.StdOut, pattern, options).Success)
diff --git a/test/dotnet-msbuild.Tests/GivenDotnetPackInvocation.cs b/test/dotnet-msbuild.Tests/GivenDotnetPackInvocation.cs
index 74559a6fa..fa666f150 100644
--- a/test/dotnet-msbuild.Tests/GivenDotnetPackInvocation.cs
+++ b/test/dotnet-msbuild.Tests/GivenDotnetPackInvocation.cs
@@ -12,6 +12,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
public class GivenDotnetPackInvocation
{
const string ExpectedPrefix = "exec /m /v:m /restore /t:pack";
+ const string ExpectedNoBuildPrefix = "exec /m /v:m /t:pack";
[Theory]
[InlineData(new string[] { }, "")]
@@ -34,9 +35,10 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
var msbuildPath = "";
var command = PackCommand.FromArgs(args, msbuildPath);
+ var expectedPrefix = args.FirstOrDefault() == "--no-build" ? ExpectedNoBuildPrefix : ExpectedPrefix;
command.SeparateRestoreCommand.Should().BeNull();
- command.GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix}{expectedAdditionalArgs}");
+ command.GetProcessStartInfo().Arguments.Should().Be($"{expectedPrefix}{expectedAdditionalArgs}");
}
}
}
diff --git a/test/dotnet-pack.Tests/PackTests.cs b/test/dotnet-pack.Tests/PackTests.cs
index 32b940a45..1c24fa5c9 100644
--- a/test/dotnet-pack.Tests/PackTests.cs
+++ b/test/dotnet-pack.Tests/PackTests.cs
@@ -186,6 +186,25 @@ namespace Microsoft.DotNet.Tools.Pack.Tests
.Should().Pass();
}
+ [Fact]
+ public void ItDoesNotImplicitlyBuildAProjectWhenPackagingWithTheNoBuildOption()
+ {
+ var testInstance = TestAssets.Get("TestAppSimple")
+ .CreateInstance()
+ .WithSourceFiles();
+
+ var result = new PackCommand()
+ .WithWorkingDirectory(testInstance.Root)
+ .ExecuteWithCapturedOutput("--no-build");
+
+ result.Should().Fail();
+ if (!DotnetUnderTest.IsLocalized())
+ {
+ result.Should().NotHaveStdOutContaining("Restore")
+ .And.HaveStdOutContaining("project.assets.json");
+ }
+ }
+
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenPackagingWithTheNoRestoreOption()
{