Make --no-build imply --no-restore for run command.

This commit makes the `--no-build` option for the run command
automatically imply `--no-restore`.

Fixes issue #7472.
This commit is contained in:
Peter Huene 2017-11-27 21:09:26 -08:00
parent ea85555a97
commit 4f7c76b4e4
16 changed files with 47 additions and 96 deletions

View file

@ -124,14 +124,11 @@
<value>Command used to run .NET apps</value>
</data>
<data name="CommandOptionNoBuildDescription" xml:space="preserve">
<value>Skip building the project prior to running. By default, the project will be built.</value>
<value>Do not build project before running. Implies --no-restore.</value>
</data>
<data name="CommandOptionFrameworkDescription" xml:space="preserve">
<value>Build and run the app using the specified framework. The framework has to be specified in the project file. </value>
</data>
<data name="CommandOptionNoBuild" xml:space="preserve">
<value>Do not build the project before running.</value>
</data>
<data name="CommandOptionProjectDescription" xml:space="preserve">
<value>The path to the project file to run (defaults to the current directory if there is only one project).</value>
</data>

View file

@ -26,7 +26,7 @@ namespace Microsoft.DotNet.Cli
project: o.SingleArgumentOrDefault("--project"),
launchProfile: o.SingleArgumentOrDefault("--launch-profile"),
noLaunchProfile: o.HasOption("--no-launch-profile"),
noRestore: o.HasOption("--no-restore"),
noRestore: o.HasOption("--no-restore") || o.HasOption("--no-build"),
restoreArgs: o.OptionValuesToBeForwarded(),
args: o.Arguments
)),

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Před spuštěním vynechá sestavení projektu. Standardně se projekt sestaví.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Před spuštěním nesestavovat projekt</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Před spuštěním vynechá sestavení projektu. Standardně se projekt sestaví.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Überspringen Sie die Erstellung des Projekts vor dem Ausführen. Das Projekt wird standardmäßig erstellt.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Erstellen Sie das Projekt nicht vor dem Ausführen.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Überspringen Sie die Erstellung des Projekts vor dem Ausführen. Das Projekt wird standardmäßig erstellt.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Omite la compilación del proyecto antes de ejecutarlo. El proyecto se compilará de manera predeterminada.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">No se compila el proyecto antes de ejecutarlo.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Omite la compilación del proyecto antes de ejecutarlo. El proyecto se compilará de manera predeterminada.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Ignorez la génération du projet avant l'exécution. Par défaut, le projet est généré.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Ne générez pas le projet avant l'exécution.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Ignorez la génération du projet avant l'exécution. Par défaut, le projet est généré.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Consente di ignorare la compilazione del progetto prima dell'esecuzione. Per impostazione predefinita, il progetto verrà compilato.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Non compilare il progetto prima dell'esecuzione.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Consente di ignorare la compilazione del progetto prima dell'esecuzione. Per impostazione predefinita, il progetto verrà compilato.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">実行の前に、プロジェクトのビルドをスキップします。既定では、プロジェクトはビルドされます。</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">実行する前にプロジェクトをビルドしません。</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">実行の前に、プロジェクトのビルドをスキップします。既定では、プロジェクトはビルドされます。</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">실행하기 전에 프로젝트를 빌드하지 않습니다. 기본적으로 프로젝트가 빌드됩니다.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">실행하기 전에 프로젝트를 빌드하지 않습니다.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">실행하기 전에 프로젝트를 빌드하지 않습니다. 기본적으로 프로젝트가 빌드됩니다.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Pomiń kompilację projektu przed uruchomieniem. Domyślnie projekt zostanie skompilowany.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Nie kompiluj projektu przed uruchomieniem.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Pomiń kompilację projektu przed uruchomieniem. Domyślnie projekt zostanie skompilowany.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Ignorar a compilação do projeto antes da execução. Por padrão, o projeto será compilado.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Não compilar o projeto antes da execução.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Ignorar a compilação do projeto antes da execução. Por padrão, o projeto será compilado.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Пропуск сборки проекта перед запуском. По умолчанию выполняется сборка проекта.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Не выполнять сборку проекта перед запуском.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Пропуск сборки проекта перед запуском. По умолчанию выполняется сборка проекта.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Projeyi çalıştırmadan önce derlemeyi atlayın. Varsayılan olarak, proje derlenir.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Projeyi çalıştırmadan önce derleme.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Projeyi çalıştırmadan önce derlemeyi atlayın. Varsayılan olarak, proje derlenir.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">在运行之前跳过项目生成操作。将默认生成项目。</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">运行之前不要生成项目。</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">在运行之前跳过项目生成操作。将默认生成项目。</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">在執行之前跳過建置該專案。根據預設,將會建置該專案。</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">請勿在執行之前建置專案。</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">在執行之前跳過建置該專案。根據預設,將會建置該專案。</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -75,6 +75,25 @@ namespace Microsoft.DotNet.Cli.Run.Tests
.And.HaveStdOutContaining("This string came from the test library!");
}
[Fact]
public void ItDoesNotImplicitlyBuildAProjectWhenRunningWithTheNoBuildOption()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var result = new RunCommand()
.WithWorkingDirectory(testInstance.Root.FullName)
.ExecuteWithCapturedOutput("--no-build -v:m");
result.Should().Fail();
if (!DotnetUnderTest.IsLocalized())
{
result.Should().NotHaveStdOutContaining("Restore");
}
}
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenRunningWithTheNoRestoreOption()
{