Replacing all implicit msbuild parameters from using a forward slash to using a dash.

This commit is contained in:
Livar Cunha 2018-04-02 14:44:43 -07:00
parent 7c37c9a069
commit 10289504a8
33 changed files with 179 additions and 179 deletions

View file

@ -85,7 +85,7 @@ namespace Microsoft.DotNet.Cli.Build
{ {
if (!string.IsNullOrEmpty(Runtime)) if (!string.IsNullOrEmpty(Runtime))
{ {
return $"/p:RuntimeIdentifier={Runtime}"; return $"-p:RuntimeIdentifier={Runtime}";
} }
return null; return null;

View file

@ -71,7 +71,7 @@ namespace Microsoft.DotNet.Cli.Build
{ {
if (SkipInvalidConfigurations) if (SkipInvalidConfigurations)
{ {
return "/p:SkipInvalidConfigurations=true"; return "-p:SkipInvalidConfigurations=true";
} }
return null; return null;
@ -81,7 +81,7 @@ namespace Microsoft.DotNet.Cli.Build
{ {
if (!string.IsNullOrEmpty(Runtime)) if (!string.IsNullOrEmpty(Runtime))
{ {
return $"/p:RuntimeIdentifier={Runtime}"; return $"-p:RuntimeIdentifier={Runtime}";
} }
return null; return null;

View file

@ -354,12 +354,12 @@ namespace Microsoft.DotNet.Cli.Utils
var args = new List<string>(); var args = new List<string>();
args.Add(toolDepsJsonGeneratorProject); args.Add(toolDepsJsonGeneratorProject);
args.Add($"/p:ProjectAssetsFile=\"{toolLockFile.Path}\""); args.Add($"-p:ProjectAssetsFile=\"{toolLockFile.Path}\"");
args.Add($"/p:ToolName={toolLibrary.Name}"); args.Add($"-p:ToolName={toolLibrary.Name}");
args.Add($"/p:ProjectDepsFilePath={tempDepsFile}"); args.Add($"-p:ProjectDepsFilePath={tempDepsFile}");
var toolTargetFramework = toolLockFile.Targets.First().TargetFramework.GetShortFolderName(); var toolTargetFramework = toolLockFile.Targets.First().TargetFramework.GetShortFolderName();
args.Add($"/p:TargetFramework={toolTargetFramework}"); args.Add($"-p:TargetFramework={toolTargetFramework}");
// Look for the .props file in the Microsoft.NETCore.App package, until NuGet // Look for the .props file in the Microsoft.NETCore.App package, until NuGet
@ -384,7 +384,7 @@ namespace Microsoft.DotNet.Cli.Utils
if (platformLibraryPropsFile != null) if (platformLibraryPropsFile != null)
{ {
args.Add($"/p:AdditionalImport={platformLibraryPropsFile}"); args.Add($"-p:AdditionalImport={platformLibraryPropsFile}");
} }
} }
} }

View file

@ -51,7 +51,7 @@ namespace Microsoft.DotNet.Cli.Utils
private static string Escape(string arg) => private static string Escape(string arg) =>
// this is a workaround for https://github.com/Microsoft/msbuild/issues/1622 // this is a workaround for https://github.com/Microsoft/msbuild/issues/1622
(arg.StartsWith("/p:RestoreSources=", StringComparison.OrdinalIgnoreCase)) ? (arg.StartsWith("-p:RestoreSources=", StringComparison.OrdinalIgnoreCase)) ?
arg.Replace(";", "%3B") arg.Replace(";", "%3B")
.Replace("://", ":%2F%2F") : .Replace("://", ":%2F%2F") :
arg; arg;

View file

@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Cli
"n", "normal", "n", "normal",
"d", "detailed", "d", "detailed",
"diag", "diagnostic") "diag", "diagnostic")
.ForwardAsSingle(o => $"/verbosity:{o.Arguments.Single()}")); .ForwardAsSingle(o => $"-verbosity:{o.Arguments.Single()}"));
public static Option FrameworkOption() => public static Option FrameworkOption() =>
Create.Option( Create.Option(
@ -34,7 +34,7 @@ namespace Microsoft.DotNet.Cli
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile()) .WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile())
.With(name: "FRAMEWORK") .With(name: "FRAMEWORK")
.ForwardAsSingle(o => $"/p:TargetFramework={o.Arguments.Single()}")); .ForwardAsSingle(o => $"-p:TargetFramework={o.Arguments.Single()}"));
public static Option RuntimeOption() => public static Option RuntimeOption() =>
Create.Option( Create.Option(
@ -43,7 +43,7 @@ namespace Microsoft.DotNet.Cli
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile()) .WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
.With(name: "RUNTIME_IDENTIFIER") .With(name: "RUNTIME_IDENTIFIER")
.ForwardAsSingle(o => $"/p:RuntimeIdentifier={o.Arguments.Single()}")); .ForwardAsSingle(o => $"-p:RuntimeIdentifier={o.Arguments.Single()}"));
public static Option ConfigurationOption() => public static Option ConfigurationOption() =>
Create.Option( Create.Option(
@ -52,7 +52,7 @@ namespace Microsoft.DotNet.Cli
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: "CONFIGURATION") .With(name: "CONFIGURATION")
.WithSuggestionsFrom("DEBUG", "RELEASE") .WithSuggestionsFrom("DEBUG", "RELEASE")
.ForwardAsSingle(o => $"/p:Configuration={o.Arguments.Single()}")); .ForwardAsSingle(o => $"-p:Configuration={o.Arguments.Single()}"));
public static Option VersionSuffixOption() => public static Option VersionSuffixOption() =>
Create.Option( Create.Option(
@ -60,7 +60,7 @@ namespace Microsoft.DotNet.Cli
CommonLocalizableStrings.CmdVersionSuffixDescription, CommonLocalizableStrings.CmdVersionSuffixDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: "VERSION_SUFFIX") .With(name: "VERSION_SUFFIX")
.ForwardAsSingle(o => $"/p:VersionSuffix={o.Arguments.Single()}")); .ForwardAsSingle(o => $"-p:VersionSuffix={o.Arguments.Single()}"));
public static ArgumentsRule DefaultToCurrentDirectory(this ArgumentsRule rule) => public static ArgumentsRule DefaultToCurrentDirectory(this ArgumentsRule rule) =>
rule.With(defaultValue: () => PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory())); rule.With(defaultValue: () => PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory()));

View file

@ -36,10 +36,10 @@ namespace Microsoft.DotNet.Tools
if (HasArgumentToExcludeFromRestore(parsedArguments)) if (HasArgumentToExcludeFromRestore(parsedArguments))
{ {
return Prepend("/nologo", msbuildArgs); return Prepend("-nologo", msbuildArgs);
} }
return Prepend("/restore", msbuildArgs); return Prepend("-restore", msbuildArgs);
} }
private static RestoreCommand GetSeparateRestoreCommand( private static RestoreCommand GetSeparateRestoreCommand(
@ -70,7 +70,7 @@ namespace Microsoft.DotNet.Tools
=> arguments.Any(a => IsExcludedFromRestore(a)); => arguments.Any(a => IsExcludedFromRestore(a));
private static bool IsExcludedFromRestore(string argument) private static bool IsExcludedFromRestore(string argument)
=> argument.StartsWith("/p:TargetFramework=", StringComparison.Ordinal); => argument.StartsWith("-p:TargetFramework=", StringComparison.Ordinal);
public override int Execute() public override int Execute()
{ {

View file

@ -99,19 +99,19 @@ namespace Microsoft.DotNet.Tools.Add.PackageReference
args.Add(projectFilePath); args.Add(projectFilePath);
// Pass the task as generate restore Dependency Graph file // Pass the task as generate restore Dependency Graph file
args.Add("/t:GenerateRestoreGraphFile"); args.Add("-t:GenerateRestoreGraphFile");
// Pass Dependency Graph file output path // Pass Dependency Graph file output path
args.Add($"/p:RestoreGraphOutputPath=\"{dgFilePath}\""); args.Add($"-p:RestoreGraphOutputPath=\"{dgFilePath}\"");
// Turn off recursive restore // Turn off recursive restore
args.Add($"/p:RestoreRecursive=false"); args.Add($"-p:RestoreRecursive=false");
// Turn off restore for Dotnet cli tool references so that we do not generate extra dg specs // Turn off restore for Dotnet cli tool references so that we do not generate extra dg specs
args.Add($"/p:RestoreDotnetCliToolReferences=false"); args.Add($"-p:RestoreDotnetCliToolReferences=false");
// Output should not include MSBuild version header // Output should not include MSBuild version header
args.Add("/nologo"); args.Add("-nologo");
var result = new MSBuildForwardingApp(args).Execute(); var result = new MSBuildForwardingApp(args).Execute();

View file

@ -37,15 +37,15 @@ namespace Microsoft.DotNet.Tools.Build
var appliedBuildOptions = result["dotnet"]["build"]; var appliedBuildOptions = result["dotnet"]["build"];
msbuildArgs.Add($"/clp:Summary"); msbuildArgs.Add($"-clp:Summary");
if (appliedBuildOptions.HasOption("--no-incremental")) if (appliedBuildOptions.HasOption("--no-incremental"))
{ {
msbuildArgs.Add("/t:Rebuild"); msbuildArgs.Add("-t:Rebuild");
} }
else else
{ {
msbuildArgs.Add("/t:Build"); msbuildArgs.Add("-t:Build");
} }
msbuildArgs.AddRange(appliedBuildOptions.OptionValuesToBeForwarded()); msbuildArgs.AddRange(appliedBuildOptions.OptionValuesToBeForwarded());

View file

@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.OutputOptionDescription, LocalizableStrings.OutputOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.OutputOptionName) .With(name: LocalizableStrings.OutputOptionName)
.ForwardAsSingle(o => $"/p:OutputPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:OutputPath={o.Arguments.Single()}")),
CommonOptions.FrameworkOption(), CommonOptions.FrameworkOption(),
CommonOptions.RuntimeOption(), CommonOptions.RuntimeOption(),
CommonOptions.ConfigurationOption(), CommonOptions.ConfigurationOption(),
@ -37,7 +37,7 @@ namespace Microsoft.DotNet.Cli
"--no-dependencies", "--no-dependencies",
LocalizableStrings.NoDependenciesOptionDescription, LocalizableStrings.NoDependenciesOptionDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs("/p:BuildProjectReferences=false")), .ForwardAs("-p:BuildProjectReferences=false")),
CommonOptions.NoRestoreOption(), CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());
} }

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdOutputDirDescription, LocalizableStrings.CmdOutputDirDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdOutputDir) .With(name: LocalizableStrings.CmdOutputDir)
.ForwardAsSingle(o => $"/p:OutputPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:OutputPath={o.Arguments.Single()}")),
CommonOptions.FrameworkOption(), CommonOptions.FrameworkOption(),
CommonOptions.RuntimeOption(), CommonOptions.RuntimeOption(),
CommonOptions.ConfigurationOption(), CommonOptions.ConfigurationOption(),

View file

@ -21,7 +21,7 @@ namespace Microsoft.DotNet.Tools.Clean
{ {
var msbuildArgs = new List<string> var msbuildArgs = new List<string>
{ {
"/v:normal" "-v:normal"
}; };
var parser = Parser.Instance; var parser = Parser.Instance;
@ -34,7 +34,7 @@ namespace Microsoft.DotNet.Tools.Clean
msbuildArgs.AddRange(parsedClean.Arguments); msbuildArgs.AddRange(parsedClean.Arguments);
msbuildArgs.Add("/t:Clean"); msbuildArgs.Add("-t:Clean");
msbuildArgs.AddRange(parsedClean.OptionValuesToBeForwarded()); msbuildArgs.AddRange(parsedClean.OptionValuesToBeForwarded());

View file

@ -33,7 +33,7 @@ namespace Microsoft.DotNet.Tools.MSBuild
return argsToForward return argsToForward
.Concat(new[] .Concat(new[]
{ {
$"/distributedlogger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}*{forwardingLoggerType.FullName},{forwardingLoggerType.GetTypeInfo().Assembly.Location}" $"-distributedlogger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}*{forwardingLoggerType.FullName},{forwardingLoggerType.GetTypeInfo().Assembly.Location}"
}); });
} }
catch (Exception) catch (Exception)

View file

@ -36,7 +36,7 @@ namespace Microsoft.DotNet.Tools.Pack
var msbuildArgs = new List<string>() var msbuildArgs = new List<string>()
{ {
"/t:pack" "-t:pack"
}; };
msbuildArgs.AddRange(parsedPack.OptionValuesToBeForwarded()); msbuildArgs.AddRange(parsedPack.OptionValuesToBeForwarded());

View file

@ -22,25 +22,25 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdOutputDirDescription, LocalizableStrings.CmdOutputDirDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdOutputDir) .With(name: LocalizableStrings.CmdOutputDir)
.ForwardAsSingle(o => $"/p:PackageOutputPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:PackageOutputPath={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--no-build", "--no-build",
LocalizableStrings.CmdNoBuildOptionDescription, LocalizableStrings.CmdNoBuildOptionDescription,
Accept.NoArguments().ForwardAs("/p:NoBuild=true")), Accept.NoArguments().ForwardAs("-p:NoBuild=true")),
Create.Option( Create.Option(
"--include-symbols", "--include-symbols",
LocalizableStrings.CmdIncludeSymbolsDescription, LocalizableStrings.CmdIncludeSymbolsDescription,
Accept.NoArguments().ForwardAs("/p:IncludeSymbols=true")), Accept.NoArguments().ForwardAs("-p:IncludeSymbols=true")),
Create.Option( Create.Option(
"--include-source", "--include-source",
LocalizableStrings.CmdIncludeSourceDescription, LocalizableStrings.CmdIncludeSourceDescription,
Accept.NoArguments().ForwardAs("/p:IncludeSource=true")), Accept.NoArguments().ForwardAs("-p:IncludeSource=true")),
CommonOptions.ConfigurationOption(), CommonOptions.ConfigurationOption(),
CommonOptions.VersionSuffixOption(), CommonOptions.VersionSuffixOption(),
Create.Option( Create.Option(
"-s|--serviceable", "-s|--serviceable",
LocalizableStrings.CmdServiceableDescription, LocalizableStrings.CmdServiceableDescription,
Accept.NoArguments().ForwardAs("/p:Serviceable=true")), Accept.NoArguments().ForwardAs("-p:Serviceable=true")),
CommonOptions.NoRestoreOption(), CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());
} }

View file

@ -35,7 +35,7 @@ namespace Microsoft.DotNet.Tools.Publish
result.ShowHelpOrErrorIfAppropriate(); result.ShowHelpOrErrorIfAppropriate();
msbuildArgs.Add("/t:Publish"); msbuildArgs.Add("-t:Publish");
var appliedPublishOption = result["dotnet"]["publish"]; var appliedPublishOption = result["dotnet"]["publish"];

View file

@ -22,7 +22,7 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.OutputOptionDescription, LocalizableStrings.OutputOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.OutputOption) .With(name: LocalizableStrings.OutputOption)
.ForwardAsSingle(o => $"/p:PublishDir={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:PublishDir={o.Arguments.Single()}")),
CommonOptions.FrameworkOption(), CommonOptions.FrameworkOption(),
CommonOptions.RuntimeOption(), CommonOptions.RuntimeOption(),
CommonOptions.ConfigurationOption(), CommonOptions.ConfigurationOption(),
@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.ManifestOptionDescription, LocalizableStrings.ManifestOptionDescription,
Accept.OneOrMoreArguments() Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.ManifestOption) .With(name: LocalizableStrings.ManifestOption)
.ForwardAsSingle(o => $"/p:TargetManifestFiles={string.Join("%3B", o.Arguments)}")), .ForwardAsSingle(o => $"-p:TargetManifestFiles={string.Join("%3B", o.Arguments)}")),
Create.Option( Create.Option(
"--self-contained", "--self-contained",
LocalizableStrings.SelfContainedOptionDescription, LocalizableStrings.SelfContainedOptionDescription,
@ -41,7 +41,7 @@ namespace Microsoft.DotNet.Cli
.ForwardAsSingle(o => .ForwardAsSingle(o =>
{ {
string value = o.Arguments.Any() ? o.Arguments.Single() : "true"; string value = o.Arguments.Any() ? o.Arguments.Single() : "true";
return $"/p:SelfContained={value}"; return $"-p:SelfContained={value}";
})), })),
CommonOptions.NoRestoreOption(), CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());

View file

@ -35,10 +35,10 @@ namespace Microsoft.DotNet.Tools.Restore
if (noLogo) if (noLogo)
{ {
msbuildArgs.Add("/nologo"); msbuildArgs.Add("-nologo");
} }
msbuildArgs.Add("/t:Restore"); msbuildArgs.Add("-t:Restore");
msbuildArgs.AddRange(parsedRestore.OptionValuesToBeForwarded()); msbuildArgs.AddRange(parsedRestore.OptionValuesToBeForwarded());

View file

@ -47,51 +47,51 @@ namespace Microsoft.DotNet.Cli
showHelp ? LocalizableStrings.CmdSourceOptionDescription : string.Empty, showHelp ? LocalizableStrings.CmdSourceOptionDescription : string.Empty,
Accept.OneOrMoreArguments() Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.CmdSourceOption) .With(name: LocalizableStrings.CmdSourceOption)
.ForwardAsSingle(o => $"/p:RestoreSources={string.Join("%3B", o.Arguments)}")), .ForwardAsSingle(o => $"-p:RestoreSources={string.Join("%3B", o.Arguments)}")),
Create.Option( Create.Option(
useShortOptions ? "-r|--runtime" : "--runtime" , useShortOptions ? "-r|--runtime" : "--runtime" ,
LocalizableStrings.CmdRuntimeOptionDescription, LocalizableStrings.CmdRuntimeOptionDescription,
Accept.OneOrMoreArguments() Accept.OneOrMoreArguments()
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile()) .WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
.With(name: LocalizableStrings.CmdRuntimeOption) .With(name: LocalizableStrings.CmdRuntimeOption)
.ForwardAsSingle(o => $"/p:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")), .ForwardAsSingle(o => $"-p:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")),
Create.Option( Create.Option(
"--packages", "--packages",
showHelp ? LocalizableStrings.CmdPackagesOptionDescription : string.Empty, showHelp ? LocalizableStrings.CmdPackagesOptionDescription : string.Empty,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdPackagesOption) .With(name: LocalizableStrings.CmdPackagesOption)
.ForwardAsSingle(o => $"/p:RestorePackagesPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:RestorePackagesPath={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--disable-parallel", "--disable-parallel",
showHelp ? LocalizableStrings.CmdDisableParallelOptionDescription : string.Empty, showHelp ? LocalizableStrings.CmdDisableParallelOptionDescription : string.Empty,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs("/p:RestoreDisableParallel=true")), .ForwardAs("-p:RestoreDisableParallel=true")),
Create.Option( Create.Option(
"--configfile", "--configfile",
showHelp ? LocalizableStrings.CmdConfigFileOptionDescription : string.Empty, showHelp ? LocalizableStrings.CmdConfigFileOptionDescription : string.Empty,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdConfigFileOption) .With(name: LocalizableStrings.CmdConfigFileOption)
.ForwardAsSingle(o => $"/p:RestoreConfigFile={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:RestoreConfigFile={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--no-cache", "--no-cache",
showHelp ? LocalizableStrings.CmdNoCacheOptionDescription : string.Empty, showHelp ? LocalizableStrings.CmdNoCacheOptionDescription : string.Empty,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs("/p:RestoreNoCache=true")), .ForwardAs("-p:RestoreNoCache=true")),
Create.Option( Create.Option(
"--ignore-failed-sources", "--ignore-failed-sources",
showHelp ? LocalizableStrings.CmdIgnoreFailedSourcesOptionDescription : string.Empty, showHelp ? LocalizableStrings.CmdIgnoreFailedSourcesOptionDescription : string.Empty,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs("/p:RestoreIgnoreFailedSources=true")), .ForwardAs("-p:RestoreIgnoreFailedSources=true")),
Create.Option( Create.Option(
"--no-dependencies", "--no-dependencies",
LocalizableStrings.CmdNoDependenciesOptionDescription, LocalizableStrings.CmdNoDependenciesOptionDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs("/p:RestoreRecursive=false")), .ForwardAs("-p:RestoreRecursive=false")),
Create.Option( Create.Option(
useShortOptions ? "-f|--force" : "--force", useShortOptions ? "-f|--force" : "--force",
LocalizableStrings.CmdForceRestoreOptionDescription, LocalizableStrings.CmdForceRestoreOptionDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs("/p:RestoreForce=true")) .ForwardAs("-p:RestoreForce=true"))
}; };
} }
} }

View file

@ -167,12 +167,12 @@ namespace Microsoft.DotNet.Tools.Run
{ {
List<string> args = new List<string>() List<string> args = new List<string>()
{ {
"/nologo" "-nologo"
}; };
if (!RestoreArgs.Any(a => a.StartsWith("/verbosity:"))) if (!RestoreArgs.Any(a => a.StartsWith("-verbosity:")))
{ {
args.Add("/verbosity:quiet"); args.Add("-verbosity:quiet");
} }
args.AddRange(RestoreArgs); args.AddRange(RestoreArgs);

View file

@ -34,7 +34,7 @@ namespace Microsoft.DotNet.Tools.Store
throw new GracefulException(LocalizableStrings.SpecifyManifests); throw new GracefulException(LocalizableStrings.SpecifyManifests);
} }
msbuildArgs.Add("/t:ComposeStore"); msbuildArgs.Add("-t:ComposeStore");
msbuildArgs.AddRange(appliedBuildOptions.OptionValuesToBeForwarded()); msbuildArgs.AddRange(appliedBuildOptions.OptionValuesToBeForwarded());

View file

@ -37,7 +37,7 @@ namespace Microsoft.DotNet.Cli
return new[] return new[]
{ {
materializedString, materializedString,
$"/p:AdditionalProjects={string.Join("%3B", o.Arguments.Skip(1))}" $"-p:AdditionalProjects={string.Join("%3B", o.Arguments.Skip(1))}"
}; };
} }
})), })),
@ -47,30 +47,30 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.FrameworkVersionOptionDescription, LocalizableStrings.FrameworkVersionOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.FrameworkVersionOption) .With(name: LocalizableStrings.FrameworkVersionOption)
.ForwardAsSingle(o => $"/p:RuntimeFrameworkVersion={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:RuntimeFrameworkVersion={o.Arguments.Single()}")),
CommonOptions.RuntimeOption(), CommonOptions.RuntimeOption(),
Create.Option( Create.Option(
"-o|--output", "-o|--output",
LocalizableStrings.OutputOptionDescription, LocalizableStrings.OutputOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.OutputOption) .With(name: LocalizableStrings.OutputOption)
.ForwardAsSingle(o => $"/p:ComposeDir={Path.GetFullPath(o.Arguments.Single())}")), .ForwardAsSingle(o => $"-p:ComposeDir={Path.GetFullPath(o.Arguments.Single())}")),
Create.Option( Create.Option(
"-w|--working-dir", "-w|--working-dir",
LocalizableStrings.IntermediateWorkingDirOptionDescription, LocalizableStrings.IntermediateWorkingDirOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.IntermediateWorkingDirOption) .With(name: LocalizableStrings.IntermediateWorkingDirOption)
.ForwardAsSingle(o => $"/p:ComposeWorkingDir={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:ComposeWorkingDir={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--skip-optimization", "--skip-optimization",
LocalizableStrings.SkipOptimizationOptionDescription, LocalizableStrings.SkipOptimizationOptionDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs("/p:SkipOptimization=true")), .ForwardAs("-p:SkipOptimization=true")),
Create.Option( Create.Option(
"--skip-symbols", "--skip-symbols",
LocalizableStrings.SkipSymbolsOptionDescription, LocalizableStrings.SkipSymbolsOptionDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs("/p:CreateProfilingSymbols=false")), .ForwardAs("-p:CreateProfilingSymbols=false")),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());
} }
} }

View file

@ -30,10 +30,10 @@ namespace Microsoft.DotNet.Tools.Test
{ {
var msbuildArgs = new List<string>() var msbuildArgs = new List<string>()
{ {
"/t:VSTest", "-t:VSTest",
"/v:quiet", "-v:quiet",
"/nodereuse:false", // workaround for https://github.com/Microsoft/vstest/issues/1503 "-nodereuse:false", // workaround for https://github.com/Microsoft/vstest/issues/1503
"/nologo" "-nologo"
}; };
var parser = Parser.Instance; var parser = Parser.Instance;
@ -57,17 +57,17 @@ namespace Microsoft.DotNet.Tools.Test
{ {
var runSettingsArg = string.Join(";", runSettingsOptions); var runSettingsArg = string.Join(";", runSettingsOptions);
msbuildArgs.Add($"/p:VSTestCLIRunSettings=\"{runSettingsArg}\""); msbuildArgs.Add($"-p:VSTestCLIRunSettings=\"{runSettingsArg}\"");
} }
var verbosityArg = msbuildArgs.LastOrDefault(arg => arg.StartsWith("/verbosity")); var verbosityArg = msbuildArgs.LastOrDefault(arg => arg.StartsWith("-verbosity"));
if (!string.IsNullOrEmpty(verbosityArg)) if (!string.IsNullOrEmpty(verbosityArg))
{ {
var verbosity = verbosityArg.Split(':'); var verbosity = verbosityArg.Split(':');
if (verbosity.Length == 2) if (verbosity.Length == 2)
{ {
msbuildArgs.Add($"/p:VSTestVerbosity={verbosity[1]}"); msbuildArgs.Add($"-p:VSTestVerbosity={verbosity[1]}");
} }
} }

View file

@ -25,24 +25,24 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdSettingsDescription, LocalizableStrings.CmdSettingsDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdSettingsFile) .With(name: LocalizableStrings.CmdSettingsFile)
.ForwardAsSingle(o => $"/p:VSTestSetting={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:VSTestSetting={o.Arguments.Single()}")),
Create.Option( Create.Option(
"-t|--list-tests", "-t|--list-tests",
LocalizableStrings.CmdListTestsDescription, LocalizableStrings.CmdListTestsDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAsSingle(o => "/p:VSTestListTests=true")), .ForwardAsSingle(o => "-p:VSTestListTests=true")),
Create.Option( Create.Option(
"--filter", "--filter",
LocalizableStrings.CmdTestCaseFilterDescription, LocalizableStrings.CmdTestCaseFilterDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdTestCaseFilterExpression) .With(name: LocalizableStrings.CmdTestCaseFilterExpression)
.ForwardAsSingle(o => $"/p:VSTestTestCaseFilter={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:VSTestTestCaseFilter={o.Arguments.Single()}")),
Create.Option( Create.Option(
"-a|--test-adapter-path", "-a|--test-adapter-path",
LocalizableStrings.CmdTestAdapterPathDescription, LocalizableStrings.CmdTestAdapterPathDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdTestAdapterPath) .With(name: LocalizableStrings.CmdTestAdapterPath)
.ForwardAsSingle(o => $"/p:VSTestTestAdapterPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:VSTestTestAdapterPath={o.Arguments.Single()}")),
Create.Option( Create.Option(
"-l|--logger", "-l|--logger",
LocalizableStrings.CmdLoggerDescription, LocalizableStrings.CmdLoggerDescription,
@ -52,7 +52,7 @@ namespace Microsoft.DotNet.Cli
{ {
var loggersString = string.Join(";", GetSemiColonEscapedArgs(o.Arguments)); var loggersString = string.Join(";", GetSemiColonEscapedArgs(o.Arguments));
return $"/p:VSTestLogger={loggersString}"; return $"-p:VSTestLogger={loggersString}";
})), })),
CommonOptions.ConfigurationOption(), CommonOptions.ConfigurationOption(),
CommonOptions.FrameworkOption(), CommonOptions.FrameworkOption(),
@ -61,35 +61,35 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdOutputDescription, LocalizableStrings.CmdOutputDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdOutputDir) .With(name: LocalizableStrings.CmdOutputDir)
.ForwardAsSingle(o => $"/p:OutputPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:OutputPath={o.Arguments.Single()}")),
Create.Option( Create.Option(
"-d|--diag", "-d|--diag",
LocalizableStrings.CmdPathTologFileDescription, LocalizableStrings.CmdPathTologFileDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdPathToLogFile) .With(name: LocalizableStrings.CmdPathToLogFile)
.ForwardAsSingle(o => $"/p:VSTestDiag={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:VSTestDiag={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--no-build", "--no-build",
LocalizableStrings.CmdNoBuildDescription, LocalizableStrings.CmdNoBuildDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAsSingle(o => "/p:VSTestNoBuild=true")), .ForwardAsSingle(o => "-p:VSTestNoBuild=true")),
Create.Option( Create.Option(
"-r|--results-directory", "-r|--results-directory",
LocalizableStrings.CmdResultsDirectoryDescription, LocalizableStrings.CmdResultsDirectoryDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdPathToResultsDirectory) .With(name: LocalizableStrings.CmdPathToResultsDirectory)
.ForwardAsSingle(o => $"/p:VSTestResultsDirectory={o.Arguments.Single()}")), .ForwardAsSingle(o => $"-p:VSTestResultsDirectory={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--collect", "--collect",
LocalizableStrings.cmdCollectDescription, LocalizableStrings.cmdCollectDescription,
Accept.OneOrMoreArguments() Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.cmdCollectFriendlyName) .With(name: LocalizableStrings.cmdCollectFriendlyName)
.ForwardAsSingle(o => $"/p:VSTestCollect=\"{string.Join(";", o.Arguments)}\"")), .ForwardAsSingle(o => $"-p:VSTestCollect=\"{string.Join(";", o.Arguments)}\"")),
Create.Option( Create.Option(
"--blame", "--blame",
LocalizableStrings.CmdBlameDescription, LocalizableStrings.CmdBlameDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAsSingle(o => "/p:VSTestBlame=true")), .ForwardAsSingle(o => "-p:VSTestBlame=true")),
CommonOptions.NoRestoreOption(), CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());

View file

@ -44,10 +44,10 @@ namespace Microsoft.DotNet.Tools.Tool.Install
{ {
"--runtime", "--runtime",
AnyRid, AnyRid,
$"/p:BaseIntermediateOutputPath={assetJsonOutput.ToXmlEncodeString()}" $"-p:BaseIntermediateOutputPath={assetJsonOutput.ToXmlEncodeString()}"
}); });
argsToPassToRestore.Add($"/verbosity:{verbosity ?? "quiet"}"); argsToPassToRestore.Add($"-verbosity:{verbosity ?? "quiet"}");
var command = new DotNetCommandFactory(alwaysRunOutOfProc: true) var command = new DotNetCommandFactory(alwaysRunOutOfProc: true)
.Create("restore", argsToPassToRestore); .Create("restore", argsToPassToRestore);

View file

@ -35,7 +35,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
return null; return null;
} }
return $"/p:RuntimeIdentifier={_runtime}"; return $"-p:RuntimeIdentifier={_runtime}";
} }
} }
} }

View file

@ -35,7 +35,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
return null; return null;
} }
return $"/p:RuntimeIdentifier={_runtime}"; return $"-p:RuntimeIdentifier={_runtime}";
} }
} }
} }

View file

@ -12,22 +12,22 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
const string ExpectedPrefix = "exec <msbuildpath> -m -v:m"; const string ExpectedPrefix = "exec <msbuildpath> -m -v:m";
[Theory] [Theory]
[InlineData(new string[] { }, "/t:Build")] [InlineData(new string[] { }, "-t:Build")]
[InlineData(new string[] { "-o", "foo" }, "/t:Build /p:OutputPath=foo")] [InlineData(new string[] { "-o", "foo" }, "-t:Build -p:OutputPath=foo")]
[InlineData(new string[] { "-p:Verbosity=diag" }, "/t:Build -p:Verbosity=diag")] [InlineData(new string[] { "-p:Verbosity=diag" }, "-t:Build -p:Verbosity=diag")]
[InlineData(new string[] { "--output", "foo" }, "/t:Build /p:OutputPath=foo")] [InlineData(new string[] { "--output", "foo" }, "-t:Build -p:OutputPath=foo")]
[InlineData(new string[] { "-o", "foo1 foo2" }, "/t:Build \"/p:OutputPath=foo1 foo2\"")] [InlineData(new string[] { "-o", "foo1 foo2" }, "-t:Build \"-p:OutputPath=foo1 foo2\"")]
[InlineData(new string[] { "--no-incremental" }, "/t:Rebuild")] [InlineData(new string[] { "--no-incremental" }, "-t:Rebuild")]
[InlineData(new string[] { "-r", "rid" }, "/t:Build /p:RuntimeIdentifier=rid")] [InlineData(new string[] { "-r", "rid" }, "-t:Build -p:RuntimeIdentifier=rid")]
[InlineData(new string[] { "--runtime", "rid" }, "/t:Build /p:RuntimeIdentifier=rid")] [InlineData(new string[] { "--runtime", "rid" }, "-t:Build -p:RuntimeIdentifier=rid")]
[InlineData(new string[] { "-c", "config" }, "/t:Build /p:Configuration=config")] [InlineData(new string[] { "-c", "config" }, "-t:Build -p:Configuration=config")]
[InlineData(new string[] { "--configuration", "config" }, "/t:Build /p:Configuration=config")] [InlineData(new string[] { "--configuration", "config" }, "-t:Build -p:Configuration=config")]
[InlineData(new string[] { "--version-suffix", "mysuffix" }, "/t:Build /p:VersionSuffix=mysuffix")] [InlineData(new string[] { "--version-suffix", "mysuffix" }, "-t:Build -p:VersionSuffix=mysuffix")]
[InlineData(new string[] { "--no-dependencies" }, "/t:Build /p:BuildProjectReferences=false")] [InlineData(new string[] { "--no-dependencies" }, "-t:Build -p:BuildProjectReferences=false")]
[InlineData(new string[] { "-v", "diag" }, "/t:Build /verbosity:diag")] [InlineData(new string[] { "-v", "diag" }, "-t:Build -verbosity:diag")]
[InlineData(new string[] { "--verbosity", "diag" }, "/t:Build /verbosity:diag")] [InlineData(new string[] { "--verbosity", "diag" }, "-t:Build -verbosity:diag")]
[InlineData(new string[] { "--no-incremental", "-o", "myoutput", "-r", "myruntime", "-v", "diag", "/ArbitrarySwitchForMSBuild" }, [InlineData(new string[] { "--no-incremental", "-o", "myoutput", "-r", "myruntime", "-v", "diag", "/ArbitrarySwitchForMSBuild" },
"/t:Rebuild /p:OutputPath=myoutput /p:RuntimeIdentifier=myruntime /verbosity:diag /ArbitrarySwitchForMSBuild")] "-t:Rebuild -p:OutputPath=myoutput -p:RuntimeIdentifier=myruntime -verbosity:diag /ArbitrarySwitchForMSBuild")]
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
{ {
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}"); expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
@ -39,14 +39,14 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
command.GetProcessStartInfo() command.GetProcessStartInfo()
.Arguments.Should() .Arguments.Should()
.Be($"{ExpectedPrefix} /restore /clp:Summary{expectedAdditionalArgs}"); .Be($"{ExpectedPrefix} -restore -clp:Summary{expectedAdditionalArgs}");
} }
[Theory] [Theory]
[InlineData(new string[] { "-f", "tfm" }, "/t:Restore", "/t:Build /p:TargetFramework=tfm")] [InlineData(new string[] { "-f", "tfm" }, "-t:Restore", "-t:Build -p:TargetFramework=tfm")]
[InlineData(new string[] { "-o", "myoutput", "-f", "tfm", "-v", "diag", "/ArbitrarySwitchForMSBuild" }, [InlineData(new string[] { "-o", "myoutput", "-f", "tfm", "-v", "diag", "/ArbitrarySwitchForMSBuild" },
"/t:Restore /p:OutputPath=myoutput /verbosity:diag /ArbitrarySwitchForMSBuild", "-t:Restore -p:OutputPath=myoutput -verbosity:diag /ArbitrarySwitchForMSBuild",
"/t:Build /p:OutputPath=myoutput /p:TargetFramework=tfm /verbosity:diag /ArbitrarySwitchForMSBuild")] "-t:Build -p:OutputPath=myoutput -p:TargetFramework=tfm -verbosity:diag /ArbitrarySwitchForMSBuild")]
public void MsbuildInvocationIsCorrectForSeparateRestore( public void MsbuildInvocationIsCorrectForSeparateRestore(
string[] args, string[] args,
string expectedAdditionalArgsForRestore, string expectedAdditionalArgsForRestore,
@ -63,7 +63,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
command.GetProcessStartInfo() command.GetProcessStartInfo()
.Arguments.Should() .Arguments.Should()
.Be($"{ExpectedPrefix} /nologo /clp:Summary{expectedAdditionalArgs}"); .Be($"{ExpectedPrefix} -nologo -clp:Summary{expectedAdditionalArgs}");
} }
} }

View file

@ -10,26 +10,26 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
{ {
public class GivenDotnetCleanInvocation public class GivenDotnetCleanInvocation
{ {
const string ExpectedPrefix = "exec <msbuildpath> -m -v:m /v:normal /t:Clean"; const string ExpectedPrefix = "exec <msbuildpath> -m -v:m -v:normal -t:Clean";
[Fact] [Fact]
public void ItAddsProjectToMsbuildInvocation() public void ItAddsProjectToMsbuildInvocation()
{ {
var msbuildPath = "<msbuildpath>"; var msbuildPath = "<msbuildpath>";
CleanCommand.FromArgs(new string[] { "<project>" }, msbuildPath) CleanCommand.FromArgs(new string[] { "<project>" }, msbuildPath)
.GetProcessStartInfo().Arguments.Should().Be("exec <msbuildpath> -m -v:m /v:normal <project> /t:Clean"); .GetProcessStartInfo().Arguments.Should().Be("exec <msbuildpath> -m -v:m -v:normal <project> -t:Clean");
} }
[Theory] [Theory]
[InlineData(new string[] { }, "")] [InlineData(new string[] { }, "")]
[InlineData(new string[] { "-o", "<output>" }, "/p:OutputPath=<output>")] [InlineData(new string[] { "-o", "<output>" }, "-p:OutputPath=<output>")]
[InlineData(new string[] { "--output", "<output>" }, "/p:OutputPath=<output>")] [InlineData(new string[] { "--output", "<output>" }, "-p:OutputPath=<output>")]
[InlineData(new string[] { "-f", "<framework>" }, "/p:TargetFramework=<framework>")] [InlineData(new string[] { "-f", "<framework>" }, "-p:TargetFramework=<framework>")]
[InlineData(new string[] { "--framework", "<framework>" }, "/p:TargetFramework=<framework>")] [InlineData(new string[] { "--framework", "<framework>" }, "-p:TargetFramework=<framework>")]
[InlineData(new string[] { "-c", "<configuration>" }, "/p:Configuration=<configuration>")] [InlineData(new string[] { "-c", "<configuration>" }, "-p:Configuration=<configuration>")]
[InlineData(new string[] { "--configuration", "<configuration>" }, "/p:Configuration=<configuration>")] [InlineData(new string[] { "--configuration", "<configuration>" }, "-p:Configuration=<configuration>")]
[InlineData(new string[] { "-v", "diag" }, "/verbosity:diag")] [InlineData(new string[] { "-v", "diag" }, "-verbosity:diag")]
[InlineData(new string[] { "--verbosity", "diag" }, "/verbosity:diag")] [InlineData(new string[] { "--verbosity", "diag" }, "-verbosity:diag")]
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
{ {
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}"); expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");

View file

@ -138,7 +138,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
allArgs.Should().NotBeNull(); allArgs.Should().NotBeNull();
allArgs.Should().Contain( allArgs.Should().Contain(
value => value.IndexOf("/distributedlogger", StringComparison.OrdinalIgnoreCase) >= 0, value => value.IndexOf("-distributedlogger", StringComparison.OrdinalIgnoreCase) >= 0,
"The MSBuild logger argument should be specified when telemetry is enabled."); "The MSBuild logger argument should be specified when telemetry is enabled.");
} }
} }
@ -151,7 +151,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
allArgs.Should().NotBeNull(); allArgs.Should().NotBeNull();
allArgs.Should().NotContain( allArgs.Should().NotContain(
value => value.IndexOf("/Logger", StringComparison.OrdinalIgnoreCase) >= 0, value => value.IndexOf("-logger", StringComparison.OrdinalIgnoreCase) >= 0,
$"The MSBuild logger argument should not be specified when telemetry is disabled."); $"The MSBuild logger argument should not be specified when telemetry is disabled.");
} }

View file

@ -11,23 +11,23 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
{ {
public class GivenDotnetPackInvocation public class GivenDotnetPackInvocation
{ {
const string ExpectedPrefix = "exec <msbuildpath> -m -v:m /restore /t:pack"; const string ExpectedPrefix = "exec <msbuildpath> -m -v:m -restore -t:pack";
const string ExpectedNoBuildPrefix = "exec <msbuildpath> -m -v:m /t:pack"; const string ExpectedNoBuildPrefix = "exec <msbuildpath> -m -v:m -t:pack";
[Theory] [Theory]
[InlineData(new string[] { }, "")] [InlineData(new string[] { }, "")]
[InlineData(new string[] { "-o", "<packageoutputpath>" }, "/p:PackageOutputPath=<packageoutputpath>")] [InlineData(new string[] { "-o", "<packageoutputpath>" }, "-p:PackageOutputPath=<packageoutputpath>")]
[InlineData(new string[] { "--output", "<packageoutputpath>" }, "/p:PackageOutputPath=<packageoutputpath>")] [InlineData(new string[] { "--output", "<packageoutputpath>" }, "-p:PackageOutputPath=<packageoutputpath>")]
[InlineData(new string[] { "--no-build" }, "/p:NoBuild=true")] [InlineData(new string[] { "--no-build" }, "-p:NoBuild=true")]
[InlineData(new string[] { "--include-symbols" }, "/p:IncludeSymbols=true")] [InlineData(new string[] { "--include-symbols" }, "-p:IncludeSymbols=true")]
[InlineData(new string[] { "--include-source" }, "/p:IncludeSource=true")] [InlineData(new string[] { "--include-source" }, "-p:IncludeSource=true")]
[InlineData(new string[] { "-c", "<config>" }, "/p:Configuration=<config>")] [InlineData(new string[] { "-c", "<config>" }, "-p:Configuration=<config>")]
[InlineData(new string[] { "--configuration", "<config>" }, "/p:Configuration=<config>")] [InlineData(new string[] { "--configuration", "<config>" }, "-p:Configuration=<config>")]
[InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "/p:VersionSuffix=<versionsuffix>")] [InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "-p:VersionSuffix=<versionsuffix>")]
[InlineData(new string[] { "-s" }, "/p:Serviceable=true")] [InlineData(new string[] { "-s" }, "-p:Serviceable=true")]
[InlineData(new string[] { "--serviceable" }, "/p:Serviceable=true")] [InlineData(new string[] { "--serviceable" }, "-p:Serviceable=true")]
[InlineData(new string[] { "-v", "diag" }, "/verbosity:diag")] [InlineData(new string[] { "-v", "diag" }, "-verbosity:diag")]
[InlineData(new string[] { "--verbosity", "diag" }, "/verbosity:diag")] [InlineData(new string[] { "--verbosity", "diag" }, "-verbosity:diag")]
[InlineData(new string[] { "<project>" }, "<project>")] [InlineData(new string[] { "<project>" }, "<project>")]
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
{ {

View file

@ -24,16 +24,16 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[Theory] [Theory]
[InlineData(new string[] { }, "")] [InlineData(new string[] { }, "")]
[InlineData(new string[] { "-r", "<rid>" }, "/p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "-r", "<rid>" }, "-p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--runtime", "<rid>" }, "/p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "--runtime", "<rid>" }, "-p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "-o", "<publishdir>" }, "/p:PublishDir=<publishdir>")] [InlineData(new string[] { "-o", "<publishdir>" }, "-p:PublishDir=<publishdir>")]
[InlineData(new string[] { "--output", "<publishdir>" }, "/p:PublishDir=<publishdir>")] [InlineData(new string[] { "--output", "<publishdir>" }, "-p:PublishDir=<publishdir>")]
[InlineData(new string[] { "-c", "<config>" }, "/p:Configuration=<config>")] [InlineData(new string[] { "-c", "<config>" }, "-p:Configuration=<config>")]
[InlineData(new string[] { "--configuration", "<config>" }, "/p:Configuration=<config>")] [InlineData(new string[] { "--configuration", "<config>" }, "-p:Configuration=<config>")]
[InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "/p:VersionSuffix=<versionsuffix>")] [InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "-p:VersionSuffix=<versionsuffix>")]
[InlineData(new string[] { "--manifest", "<manifestfiles>" }, "/p:TargetManifestFiles=<manifestfiles>")] [InlineData(new string[] { "--manifest", "<manifestfiles>" }, "-p:TargetManifestFiles=<manifestfiles>")]
[InlineData(new string[] { "-v", "minimal" }, "/verbosity:minimal")] [InlineData(new string[] { "-v", "minimal" }, "-verbosity:minimal")]
[InlineData(new string[] { "--verbosity", "minimal" }, "/verbosity:minimal")] [InlineData(new string[] { "--verbosity", "minimal" }, "-verbosity:minimal")]
[InlineData(new string[] { "<project>" }, "<project>")] [InlineData(new string[] { "<project>" }, "<project>")]
[InlineData(new string[] { "<project>", "<extra-args>" }, "<project> <extra-args>")] [InlineData(new string[] { "<project>", "<extra-args>" }, "<project> <extra-args>")]
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
@ -49,12 +49,12 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
command.GetProcessStartInfo() command.GetProcessStartInfo()
.Arguments.Should() .Arguments.Should()
.Be($"{ExpectedPrefix} /restore /t:Publish{expectedAdditionalArgs}"); .Be($"{ExpectedPrefix} -restore -t:Publish{expectedAdditionalArgs}");
} }
[Theory] [Theory]
[InlineData(new string[] { "-f", "<tfm>" }, "/p:TargetFramework=<tfm>")] [InlineData(new string[] { "-f", "<tfm>" }, "-p:TargetFramework=<tfm>")]
[InlineData(new string[] { "--framework", "<tfm>" }, "/p:TargetFramework=<tfm>")] [InlineData(new string[] { "--framework", "<tfm>" }, "-p:TargetFramework=<tfm>")]
public void MsbuildInvocationIsCorrectForSeparateRestore(string[] args, string expectedAdditionalArgs) public void MsbuildInvocationIsCorrectForSeparateRestore(string[] args, string expectedAdditionalArgs)
{ {
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}"); expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
@ -65,27 +65,27 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
command.SeparateRestoreCommand command.SeparateRestoreCommand
.GetProcessStartInfo() .GetProcessStartInfo()
.Arguments.Should() .Arguments.Should()
.Be($"{ExpectedPrefix} /t:Restore"); .Be($"{ExpectedPrefix} -t:Restore");
command.GetProcessStartInfo() command.GetProcessStartInfo()
.Arguments.Should() .Arguments.Should()
.Be($"{ExpectedPrefix} /nologo /t:Publish{expectedAdditionalArgs}"); .Be($"{ExpectedPrefix} -nologo -t:Publish{expectedAdditionalArgs}");
} }
[Theory] [Theory]
[InlineData(new string[] { }, "")] [InlineData(new string[] { }, "")]
[InlineData(new string[] { "-f", "<tfm>" }, "/p:TargetFramework=<tfm>")] [InlineData(new string[] { "-f", "<tfm>" }, "-p:TargetFramework=<tfm>")]
[InlineData(new string[] { "--framework", "<tfm>" }, "/p:TargetFramework=<tfm>")] [InlineData(new string[] { "--framework", "<tfm>" }, "-p:TargetFramework=<tfm>")]
[InlineData(new string[] { "-r", "<rid>" }, "/p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "-r", "<rid>" }, "-p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--runtime", "<rid>" }, "/p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "--runtime", "<rid>" }, "-p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "-o", "<publishdir>" }, "/p:PublishDir=<publishdir>")] [InlineData(new string[] { "-o", "<publishdir>" }, "-p:PublishDir=<publishdir>")]
[InlineData(new string[] { "--output", "<publishdir>" }, "/p:PublishDir=<publishdir>")] [InlineData(new string[] { "--output", "<publishdir>" }, "-p:PublishDir=<publishdir>")]
[InlineData(new string[] { "-c", "<config>" }, "/p:Configuration=<config>")] [InlineData(new string[] { "-c", "<config>" }, "-p:Configuration=<config>")]
[InlineData(new string[] { "--configuration", "<config>" }, "/p:Configuration=<config>")] [InlineData(new string[] { "--configuration", "<config>" }, "-p:Configuration=<config>")]
[InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "/p:VersionSuffix=<versionsuffix>")] [InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "-p:VersionSuffix=<versionsuffix>")]
[InlineData(new string[] { "--manifest", "<manifestfiles>" }, "/p:TargetManifestFiles=<manifestfiles>")] [InlineData(new string[] { "--manifest", "<manifestfiles>" }, "-p:TargetManifestFiles=<manifestfiles>")]
[InlineData(new string[] { "-v", "minimal" }, "/verbosity:minimal")] [InlineData(new string[] { "-v", "minimal" }, "-verbosity:minimal")]
[InlineData(new string[] { "--verbosity", "minimal" }, "/verbosity:minimal")] [InlineData(new string[] { "--verbosity", "minimal" }, "-verbosity:minimal")]
public void OptionForwardingIsCorrect(string[] args, string expectedAdditionalArgs) public void OptionForwardingIsCorrect(string[] args, string expectedAdditionalArgs)
{ {
var expectedArgs = expectedAdditionalArgs.Split(' ', StringSplitOptions.RemoveEmptyEntries); var expectedArgs = expectedAdditionalArgs.Split(' ', StringSplitOptions.RemoveEmptyEntries);

View file

@ -11,24 +11,24 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
public class GivenDotnetRestoreInvocation public class GivenDotnetRestoreInvocation
{ {
private const string ExpectedPrefix = private const string ExpectedPrefix =
"exec <msbuildpath> -m -v:m /nologo /t:Restore"; "exec <msbuildpath> -m -v:m -nologo -t:Restore";
[Theory] [Theory]
[InlineData(new string[] { }, "")] [InlineData(new string[] { }, "")]
[InlineData(new string[] { "-s", "<source>" }, "/p:RestoreSources=<source>")] [InlineData(new string[] { "-s", "<source>" }, "-p:RestoreSources=<source>")]
[InlineData(new string[] { "--source", "<source>" }, "/p:RestoreSources=<source>")] [InlineData(new string[] { "--source", "<source>" }, "-p:RestoreSources=<source>")]
[InlineData(new string[] { "-s", "<source0>", "-s", "<source1>" }, "/p:RestoreSources=<source0>%3B<source1>")] [InlineData(new string[] { "-s", "<source0>", "-s", "<source1>" }, "-p:RestoreSources=<source0>%3B<source1>")]
[InlineData(new string[] { "-r", "<runtime>" }, "/p:RuntimeIdentifiers=<runtime>")] [InlineData(new string[] { "-r", "<runtime>" }, "-p:RuntimeIdentifiers=<runtime>")]
[InlineData(new string[] { "--runtime", "<runtime>" }, "/p:RuntimeIdentifiers=<runtime>")] [InlineData(new string[] { "--runtime", "<runtime>" }, "-p:RuntimeIdentifiers=<runtime>")]
[InlineData(new string[] { "-r", "<runtime0>", "-r", "<runtime1>" }, "/p:RuntimeIdentifiers=<runtime0>%3B<runtime1>")] [InlineData(new string[] { "-r", "<runtime0>", "-r", "<runtime1>" }, "-p:RuntimeIdentifiers=<runtime0>%3B<runtime1>")]
[InlineData(new string[] { "--packages", "<packages>" }, "/p:RestorePackagesPath=<packages>")] [InlineData(new string[] { "--packages", "<packages>" }, "-p:RestorePackagesPath=<packages>")]
[InlineData(new string[] { "--disable-parallel" }, "/p:RestoreDisableParallel=true")] [InlineData(new string[] { "--disable-parallel" }, "-p:RestoreDisableParallel=true")]
[InlineData(new string[] { "--configfile", "<config>" }, "/p:RestoreConfigFile=<config>")] [InlineData(new string[] { "--configfile", "<config>" }, "-p:RestoreConfigFile=<config>")]
[InlineData(new string[] { "--no-cache" }, "/p:RestoreNoCache=true")] [InlineData(new string[] { "--no-cache" }, "-p:RestoreNoCache=true")]
[InlineData(new string[] { "--ignore-failed-sources" }, "/p:RestoreIgnoreFailedSources=true")] [InlineData(new string[] { "--ignore-failed-sources" }, "-p:RestoreIgnoreFailedSources=true")]
[InlineData(new string[] { "--no-dependencies" }, "/p:RestoreRecursive=false")] [InlineData(new string[] { "--no-dependencies" }, "-p:RestoreRecursive=false")]
[InlineData(new string[] { "-v", "minimal" }, @"/verbosity:minimal")] [InlineData(new string[] { "-v", "minimal" }, @"-verbosity:minimal")]
[InlineData(new string[] { "--verbosity", "minimal" }, @"/verbosity:minimal")] [InlineData(new string[] { "--verbosity", "minimal" }, @"-verbosity:minimal")]
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
{ {
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}"); expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");

View file

@ -11,7 +11,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
{ {
public class GivenDotnetStoreInvocation public class GivenDotnetStoreInvocation
{ {
const string ExpectedPrefix = "exec <msbuildpath> -m -v:m /t:ComposeStore <project>"; const string ExpectedPrefix = "exec <msbuildpath> -m -v:m -t:ComposeStore <project>";
static readonly string[] ArgsPrefix = { "-m", "<project>" }; static readonly string[] ArgsPrefix = { "-m", "<project>" };
[Theory] [Theory]
@ -26,11 +26,11 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
} }
[Theory] [Theory]
[InlineData(new string[] { "-f", "<tfm>" }, @"/p:TargetFramework=<tfm>")] [InlineData(new string[] { "-f", "<tfm>" }, @"-p:TargetFramework=<tfm>")]
[InlineData(new string[] { "--framework", "<tfm>" }, @"/p:TargetFramework=<tfm>")] [InlineData(new string[] { "--framework", "<tfm>" }, @"-p:TargetFramework=<tfm>")]
[InlineData(new string[] { "-r", "<rid>" }, @"/p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "-r", "<rid>" }, @"-p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--runtime", "<rid>" }, @"/p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "--runtime", "<rid>" }, @"-p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--manifest", "one.xml", "--manifest", "two.xml", "--manifest", "three.xml" }, @"/p:AdditionalProjects=one.xml%3Btwo.xml%3Bthree.xml")] [InlineData(new string[] { "--manifest", "one.xml", "--manifest", "two.xml", "--manifest", "three.xml" }, @"-p:AdditionalProjects=one.xml%3Btwo.xml%3Bthree.xml")]
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
{ {
args = ArgsPrefix.Concat(args).ToArray(); args = ArgsPrefix.Concat(args).ToArray();
@ -51,7 +51,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
var msbuildPath = "<msbuildpath>"; var msbuildPath = "<msbuildpath>";
StoreCommand.FromArgs(args, msbuildPath) StoreCommand.FromArgs(args, msbuildPath)
.GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix} /p:ComposeDir={Path.GetFullPath(path)}"); .GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix} -p:ComposeDir={Path.GetFullPath(path)}");
} }
} }
} }