Replacing the short form version of implicit msbuild parameters with longform ones.

This commit is contained in:
Livar Cunha 2018-04-02 15:14:32 -07:00
parent 10289504a8
commit b1fca8c4d2
31 changed files with 173 additions and 161 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 $"-property: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 "-property: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 $"-property: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($"-property:ProjectAssetsFile=\"{toolLockFile.Path}\"");
args.Add($"-p:ToolName={toolLibrary.Name}"); args.Add($"-property:ToolName={toolLibrary.Name}");
args.Add($"-p:ProjectDepsFilePath={tempDepsFile}"); args.Add($"-property:ProjectDepsFilePath={tempDepsFile}");
var toolTargetFramework = toolLockFile.Targets.First().TargetFramework.GetShortFolderName(); var toolTargetFramework = toolLockFile.Targets.First().TargetFramework.GetShortFolderName();
args.Add($"-p:TargetFramework={toolTargetFramework}"); args.Add($"-property: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($"-property:AdditionalImport={platformLibraryPropsFile}");
} }
} }
} }

View file

@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Cli.Utils
}; };
private readonly IEnumerable<string> _msbuildRequiredParameters = private readonly IEnumerable<string> _msbuildRequiredParameters =
new List<string> { "-m", "-v:m" }; new List<string> { "-maxcpucount", "-verbosity:m" };
public MSBuildForwardingAppWithoutLogging(IEnumerable<string> argsToForward, string msbuildPath = null) public MSBuildForwardingAppWithoutLogging(IEnumerable<string> argsToForward, string msbuildPath = null)
{ {
@ -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)) ? IsRestoreSources(arg) ?
arg.Replace(";", "%3B") arg.Replace(";", "%3B")
.Replace("://", ":%2F%2F") : .Replace("://", ":%2F%2F") :
arg; arg;
@ -81,6 +81,14 @@ namespace Microsoft.DotNet.Cli.Utils
{ {
return new Muxer().MuxerPath; return new Muxer().MuxerPath;
} }
private static bool IsRestoreSources(string arg)
{
return arg.StartsWith("/p:RestoreSources=", StringComparison.OrdinalIgnoreCase) ||
arg.StartsWith("/property:RestoreSources=", StringComparison.OrdinalIgnoreCase) ||
arg.StartsWith("-p:RestoreSources=", StringComparison.OrdinalIgnoreCase) ||
arg.StartsWith("-property:RestoreSources=", StringComparison.OrdinalIgnoreCase);
}
} }
} }

View file

@ -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 => $"-property: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 => $"-property: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 => $"-property: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 => $"-property: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

@ -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("-property:TargetFramework=", StringComparison.Ordinal);
public override int Execute() public override int Execute()
{ {

View file

@ -99,16 +99,16 @@ 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("-target:GenerateRestoreGraphFile");
// Pass Dependency Graph file output path // Pass Dependency Graph file output path
args.Add($"-p:RestoreGraphOutputPath=\"{dgFilePath}\""); args.Add($"-property:RestoreGraphOutputPath=\"{dgFilePath}\"");
// Turn off recursive restore // Turn off recursive restore
args.Add($"-p:RestoreRecursive=false"); args.Add($"-property: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($"-property:RestoreDotnetCliToolReferences=false");
// Output should not include MSBuild version header // Output should not include MSBuild version header
args.Add("-nologo"); args.Add("-nologo");

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($"-consoleloggerparameters:Summary");
if (appliedBuildOptions.HasOption("--no-incremental")) if (appliedBuildOptions.HasOption("--no-incremental"))
{ {
msbuildArgs.Add("-t:Rebuild"); msbuildArgs.Add("-target:Rebuild");
} }
else else
{ {
msbuildArgs.Add("-t:Build"); msbuildArgs.Add("-target: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 => $"-property: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("-property: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 => $"-property: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" "-verbosity: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("-target:Clean");
msbuildArgs.AddRange(parsedClean.OptionValuesToBeForwarded()); msbuildArgs.AddRange(parsedClean.OptionValuesToBeForwarded());

View file

@ -36,7 +36,7 @@ namespace Microsoft.DotNet.Tools.Pack
var msbuildArgs = new List<string>() var msbuildArgs = new List<string>()
{ {
"-t:pack" "-target: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 => $"-property: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("-property:NoBuild=true")),
Create.Option( Create.Option(
"--include-symbols", "--include-symbols",
LocalizableStrings.CmdIncludeSymbolsDescription, LocalizableStrings.CmdIncludeSymbolsDescription,
Accept.NoArguments().ForwardAs("-p:IncludeSymbols=true")), Accept.NoArguments().ForwardAs("-property:IncludeSymbols=true")),
Create.Option( Create.Option(
"--include-source", "--include-source",
LocalizableStrings.CmdIncludeSourceDescription, LocalizableStrings.CmdIncludeSourceDescription,
Accept.NoArguments().ForwardAs("-p:IncludeSource=true")), Accept.NoArguments().ForwardAs("-property: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("-property: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("-target: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 => $"-property: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 => $"-property: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 $"-property:SelfContained={value}";
})), })),
CommonOptions.NoRestoreOption(), CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());

View file

@ -38,7 +38,7 @@ namespace Microsoft.DotNet.Tools.Restore
msbuildArgs.Add("-nologo"); msbuildArgs.Add("-nologo");
} }
msbuildArgs.Add("-t:Restore"); msbuildArgs.Add("-target: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 => $"-property: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 => $"-property: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 => $"-property: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("-property: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 => $"-property: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("-property: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("-property:RestoreIgnoreFailedSources=true")),
Create.Option( Create.Option(
"--no-dependencies", "--no-dependencies",
LocalizableStrings.CmdNoDependenciesOptionDescription, LocalizableStrings.CmdNoDependenciesOptionDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs("-p:RestoreRecursive=false")), .ForwardAs("-property: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("-property:RestoreForce=true"))
}; };
} }
} }

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("-target: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))}" $"-property: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 => $"-property: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 => $"-property: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 => $"-property: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("-property:SkipOptimization=true")),
Create.Option( Create.Option(
"--skip-symbols", "--skip-symbols",
LocalizableStrings.SkipSymbolsOptionDescription, LocalizableStrings.SkipSymbolsOptionDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs("-p:CreateProfilingSymbols=false")), .ForwardAs("-property:CreateProfilingSymbols=false")),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());
} }
} }

View file

@ -30,8 +30,8 @@ namespace Microsoft.DotNet.Tools.Test
{ {
var msbuildArgs = new List<string>() var msbuildArgs = new List<string>()
{ {
"-t:VSTest", "-target:VSTest",
"-v:quiet", "-verbosity: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"
}; };
@ -57,7 +57,7 @@ namespace Microsoft.DotNet.Tools.Test
{ {
var runSettingsArg = string.Join(";", runSettingsOptions); var runSettingsArg = string.Join(";", runSettingsOptions);
msbuildArgs.Add($"-p:VSTestCLIRunSettings=\"{runSettingsArg}\""); msbuildArgs.Add($"-property:VSTestCLIRunSettings=\"{runSettingsArg}\"");
} }
var verbosityArg = msbuildArgs.LastOrDefault(arg => arg.StartsWith("-verbosity")); var verbosityArg = msbuildArgs.LastOrDefault(arg => arg.StartsWith("-verbosity"));
@ -67,7 +67,7 @@ namespace Microsoft.DotNet.Tools.Test
var verbosity = verbosityArg.Split(':'); var verbosity = verbosityArg.Split(':');
if (verbosity.Length == 2) if (verbosity.Length == 2)
{ {
msbuildArgs.Add($"-p:VSTestVerbosity={verbosity[1]}"); msbuildArgs.Add($"-property: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 => $"-property: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 => "-property: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 => $"-property: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 => $"-property: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 $"-property: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 => $"-property: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 => $"-property: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 => "-property: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 => $"-property: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 => $"-property: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 => "-property:VSTestBlame=true")),
CommonOptions.NoRestoreOption(), CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());

View file

@ -44,7 +44,7 @@ namespace Microsoft.DotNet.Tools.Tool.Install
{ {
"--runtime", "--runtime",
AnyRid, AnyRid,
$"-p:BaseIntermediateOutputPath={assetJsonOutput.ToXmlEncodeString()}" $"-property:BaseIntermediateOutputPath={assetJsonOutput.ToXmlEncodeString()}"
}); });
argsToPassToRestore.Add($"-verbosity:{verbosity ?? "quiet"}"); argsToPassToRestore.Add($"-verbosity:{verbosity ?? "quiet"}");

View file

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

View file

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

View file

@ -9,25 +9,25 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
{ {
public class GivenDotnetBuildInvocation public class GivenDotnetBuildInvocation
{ {
const string ExpectedPrefix = "exec <msbuildpath> -m -v:m"; const string ExpectedPrefix = "exec <msbuildpath> -maxcpucount -verbosity:m";
[Theory] [Theory]
[InlineData(new string[] { }, "-t:Build")] [InlineData(new string[] { }, "-target:Build")]
[InlineData(new string[] { "-o", "foo" }, "-t:Build -p:OutputPath=foo")] [InlineData(new string[] { "-o", "foo" }, "-target:Build -property:OutputPath=foo")]
[InlineData(new string[] { "-p:Verbosity=diag" }, "-t:Build -p:Verbosity=diag")] [InlineData(new string[] { "-property:Verbosity=diag" }, "-target:Build -property:Verbosity=diag")]
[InlineData(new string[] { "--output", "foo" }, "-t:Build -p:OutputPath=foo")] [InlineData(new string[] { "--output", "foo" }, "-target:Build -property:OutputPath=foo")]
[InlineData(new string[] { "-o", "foo1 foo2" }, "-t:Build \"-p:OutputPath=foo1 foo2\"")] [InlineData(new string[] { "-o", "foo1 foo2" }, "-target:Build \"-property:OutputPath=foo1 foo2\"")]
[InlineData(new string[] { "--no-incremental" }, "-t:Rebuild")] [InlineData(new string[] { "--no-incremental" }, "-target:Rebuild")]
[InlineData(new string[] { "-r", "rid" }, "-t:Build -p:RuntimeIdentifier=rid")] [InlineData(new string[] { "-r", "rid" }, "-target:Build -property:RuntimeIdentifier=rid")]
[InlineData(new string[] { "--runtime", "rid" }, "-t:Build -p:RuntimeIdentifier=rid")] [InlineData(new string[] { "--runtime", "rid" }, "-target:Build -property:RuntimeIdentifier=rid")]
[InlineData(new string[] { "-c", "config" }, "-t:Build -p:Configuration=config")] [InlineData(new string[] { "-c", "config" }, "-target:Build -property:Configuration=config")]
[InlineData(new string[] { "--configuration", "config" }, "-t:Build -p:Configuration=config")] [InlineData(new string[] { "--configuration", "config" }, "-target:Build -property:Configuration=config")]
[InlineData(new string[] { "--version-suffix", "mysuffix" }, "-t:Build -p:VersionSuffix=mysuffix")] [InlineData(new string[] { "--version-suffix", "mysuffix" }, "-target:Build -property:VersionSuffix=mysuffix")]
[InlineData(new string[] { "--no-dependencies" }, "-t:Build -p:BuildProjectReferences=false")] [InlineData(new string[] { "--no-dependencies" }, "-target:Build -property:BuildProjectReferences=false")]
[InlineData(new string[] { "-v", "diag" }, "-t:Build -verbosity:diag")] [InlineData(new string[] { "-v", "diag" }, "-target:Build -verbosity:diag")]
[InlineData(new string[] { "--verbosity", "diag" }, "-t:Build -verbosity:diag")] [InlineData(new string[] { "--verbosity", "diag" }, "-target: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")] "-target:Rebuild -property:OutputPath=myoutput -property: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 -consoleloggerparameters:Summary{expectedAdditionalArgs}");
} }
[Theory] [Theory]
[InlineData(new string[] { "-f", "tfm" }, "-t:Restore", "-t:Build -p:TargetFramework=tfm")] [InlineData(new string[] { "-f", "tfm" }, "-target:Restore", "-target:Build -property: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", "-target:Restore -property:OutputPath=myoutput -verbosity:diag /ArbitrarySwitchForMSBuild",
"-t:Build -p:OutputPath=myoutput -p:TargetFramework=tfm -verbosity:diag /ArbitrarySwitchForMSBuild")] "-target:Build -property:OutputPath=myoutput -property: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 -consoleloggerparameters:Summary{expectedAdditionalArgs}");
} }
} }

View file

@ -10,24 +10,24 @@ 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> -maxcpucount -verbosity:m -verbosity:normal -target: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> -maxcpucount -verbosity:m -verbosity:normal <project> -target:Clean");
} }
[Theory] [Theory]
[InlineData(new string[] { }, "")] [InlineData(new string[] { }, "")]
[InlineData(new string[] { "-o", "<output>" }, "-p:OutputPath=<output>")] [InlineData(new string[] { "-o", "<output>" }, "-property:OutputPath=<output>")]
[InlineData(new string[] { "--output", "<output>" }, "-p:OutputPath=<output>")] [InlineData(new string[] { "--output", "<output>" }, "-property:OutputPath=<output>")]
[InlineData(new string[] { "-f", "<framework>" }, "-p:TargetFramework=<framework>")] [InlineData(new string[] { "-f", "<framework>" }, "-property:TargetFramework=<framework>")]
[InlineData(new string[] { "--framework", "<framework>" }, "-p:TargetFramework=<framework>")] [InlineData(new string[] { "--framework", "<framework>" }, "-property:TargetFramework=<framework>")]
[InlineData(new string[] { "-c", "<configuration>" }, "-p:Configuration=<configuration>")] [InlineData(new string[] { "-c", "<configuration>" }, "-property:Configuration=<configuration>")]
[InlineData(new string[] { "--configuration", "<configuration>" }, "-p:Configuration=<configuration>")] [InlineData(new string[] { "--configuration", "<configuration>" }, "-property: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)

View file

@ -86,8 +86,12 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
result.StdOut.Should().Contain(MSBuildHelpText); result.StdOut.Should().Contain(MSBuildHelpText);
} }
[Fact] [Theory]
public void WhenRestoreSourcesStartsWithUnixPathThenHttpsSourceIsParsedCorrectly() [InlineData("/p")]
[InlineData("/property")]
[InlineData("-p")]
[InlineData("-property")]
public void WhenRestoreSourcesStartsWithUnixPathThenHttpsSourceIsParsedCorrectly(string propertyFormat)
{ {
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
@ -104,7 +108,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
var result = new DotnetCommand() var result = new DotnetCommand()
.WithWorkingDirectory(root) .WithWorkingDirectory(root)
.Execute($"msbuild /p:RestoreSources={somePathThatExists};https://api.nuget.org/v3/index.json /t:restore LibraryWithUnresolvablePackageReference.csproj"); .Execute($"msbuild {propertyFormat}:RestoreSources={somePathThatExists};https://api.nuget.org/v3/index.json /t:restore LibraryWithUnresolvablePackageReference.csproj");
_output.WriteLine($"[STDOUT]\n{result.StdOut}\n[STDERR]\n{result.StdErr}"); _output.WriteLine($"[STDOUT]\n{result.StdOut}\n[STDERR]\n{result.StdErr}");

View file

@ -11,21 +11,21 @@ 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> -maxcpucount -verbosity:m -restore -target:pack";
const string ExpectedNoBuildPrefix = "exec <msbuildpath> -m -v:m -t:pack"; const string ExpectedNoBuildPrefix = "exec <msbuildpath> -maxcpucount -verbosity:m -target:pack";
[Theory] [Theory]
[InlineData(new string[] { }, "")] [InlineData(new string[] { }, "")]
[InlineData(new string[] { "-o", "<packageoutputpath>" }, "-p:PackageOutputPath=<packageoutputpath>")] [InlineData(new string[] { "-o", "<packageoutputpath>" }, "-property:PackageOutputPath=<packageoutputpath>")]
[InlineData(new string[] { "--output", "<packageoutputpath>" }, "-p:PackageOutputPath=<packageoutputpath>")] [InlineData(new string[] { "--output", "<packageoutputpath>" }, "-property:PackageOutputPath=<packageoutputpath>")]
[InlineData(new string[] { "--no-build" }, "-p:NoBuild=true")] [InlineData(new string[] { "--no-build" }, "-property:NoBuild=true")]
[InlineData(new string[] { "--include-symbols" }, "-p:IncludeSymbols=true")] [InlineData(new string[] { "--include-symbols" }, "-property:IncludeSymbols=true")]
[InlineData(new string[] { "--include-source" }, "-p:IncludeSource=true")] [InlineData(new string[] { "--include-source" }, "-property:IncludeSource=true")]
[InlineData(new string[] { "-c", "<config>" }, "-p:Configuration=<config>")] [InlineData(new string[] { "-c", "<config>" }, "-property:Configuration=<config>")]
[InlineData(new string[] { "--configuration", "<config>" }, "-p:Configuration=<config>")] [InlineData(new string[] { "--configuration", "<config>" }, "-property:Configuration=<config>")]
[InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "-p:VersionSuffix=<versionsuffix>")] [InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "-property:VersionSuffix=<versionsuffix>")]
[InlineData(new string[] { "-s" }, "-p:Serviceable=true")] [InlineData(new string[] { "-s" }, "-property:Serviceable=true")]
[InlineData(new string[] { "--serviceable" }, "-p:Serviceable=true")] [InlineData(new string[] { "--serviceable" }, "-property: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>")]

View file

@ -20,18 +20,18 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
this.output = output; this.output = output;
} }
const string ExpectedPrefix = "exec <msbuildpath> -m -v:m"; const string ExpectedPrefix = "exec <msbuildpath> -maxcpucount -verbosity:m";
[Theory] [Theory]
[InlineData(new string[] { }, "")] [InlineData(new string[] { }, "")]
[InlineData(new string[] { "-r", "<rid>" }, "-p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "-r", "<rid>" }, "-property:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--runtime", "<rid>" }, "-p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "--runtime", "<rid>" }, "-property:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "-o", "<publishdir>" }, "-p:PublishDir=<publishdir>")] [InlineData(new string[] { "-o", "<publishdir>" }, "-property:PublishDir=<publishdir>")]
[InlineData(new string[] { "--output", "<publishdir>" }, "-p:PublishDir=<publishdir>")] [InlineData(new string[] { "--output", "<publishdir>" }, "-property:PublishDir=<publishdir>")]
[InlineData(new string[] { "-c", "<config>" }, "-p:Configuration=<config>")] [InlineData(new string[] { "-c", "<config>" }, "-property:Configuration=<config>")]
[InlineData(new string[] { "--configuration", "<config>" }, "-p:Configuration=<config>")] [InlineData(new string[] { "--configuration", "<config>" }, "-property:Configuration=<config>")]
[InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "-p:VersionSuffix=<versionsuffix>")] [InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "-property:VersionSuffix=<versionsuffix>")]
[InlineData(new string[] { "--manifest", "<manifestfiles>" }, "-p:TargetManifestFiles=<manifestfiles>")] [InlineData(new string[] { "--manifest", "<manifestfiles>" }, "-property: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>")]
@ -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 -target:Publish{expectedAdditionalArgs}");
} }
[Theory] [Theory]
[InlineData(new string[] { "-f", "<tfm>" }, "-p:TargetFramework=<tfm>")] [InlineData(new string[] { "-f", "<tfm>" }, "-property:TargetFramework=<tfm>")]
[InlineData(new string[] { "--framework", "<tfm>" }, "-p:TargetFramework=<tfm>")] [InlineData(new string[] { "--framework", "<tfm>" }, "-property: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,25 +65,25 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
command.SeparateRestoreCommand command.SeparateRestoreCommand
.GetProcessStartInfo() .GetProcessStartInfo()
.Arguments.Should() .Arguments.Should()
.Be($"{ExpectedPrefix} -t:Restore"); .Be($"{ExpectedPrefix} -target:Restore");
command.GetProcessStartInfo() command.GetProcessStartInfo()
.Arguments.Should() .Arguments.Should()
.Be($"{ExpectedPrefix} -nologo -t:Publish{expectedAdditionalArgs}"); .Be($"{ExpectedPrefix} -nologo -target:Publish{expectedAdditionalArgs}");
} }
[Theory] [Theory]
[InlineData(new string[] { }, "")] [InlineData(new string[] { }, "")]
[InlineData(new string[] { "-f", "<tfm>" }, "-p:TargetFramework=<tfm>")] [InlineData(new string[] { "-f", "<tfm>" }, "-property:TargetFramework=<tfm>")]
[InlineData(new string[] { "--framework", "<tfm>" }, "-p:TargetFramework=<tfm>")] [InlineData(new string[] { "--framework", "<tfm>" }, "-property:TargetFramework=<tfm>")]
[InlineData(new string[] { "-r", "<rid>" }, "-p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "-r", "<rid>" }, "-property:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--runtime", "<rid>" }, "-p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "--runtime", "<rid>" }, "-property:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "-o", "<publishdir>" }, "-p:PublishDir=<publishdir>")] [InlineData(new string[] { "-o", "<publishdir>" }, "-property:PublishDir=<publishdir>")]
[InlineData(new string[] { "--output", "<publishdir>" }, "-p:PublishDir=<publishdir>")] [InlineData(new string[] { "--output", "<publishdir>" }, "-property:PublishDir=<publishdir>")]
[InlineData(new string[] { "-c", "<config>" }, "-p:Configuration=<config>")] [InlineData(new string[] { "-c", "<config>" }, "-property:Configuration=<config>")]
[InlineData(new string[] { "--configuration", "<config>" }, "-p:Configuration=<config>")] [InlineData(new string[] { "--configuration", "<config>" }, "-property:Configuration=<config>")]
[InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "-p:VersionSuffix=<versionsuffix>")] [InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "-property:VersionSuffix=<versionsuffix>")]
[InlineData(new string[] { "--manifest", "<manifestfiles>" }, "-p:TargetManifestFiles=<manifestfiles>")] [InlineData(new string[] { "--manifest", "<manifestfiles>" }, "-property: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)

View file

@ -11,22 +11,22 @@ 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> -maxcpucount -verbosity:m -nologo -target:Restore";
[Theory] [Theory]
[InlineData(new string[] { }, "")] [InlineData(new string[] { }, "")]
[InlineData(new string[] { "-s", "<source>" }, "-p:RestoreSources=<source>")] [InlineData(new string[] { "-s", "<source>" }, "-property:RestoreSources=<source>")]
[InlineData(new string[] { "--source", "<source>" }, "-p:RestoreSources=<source>")] [InlineData(new string[] { "--source", "<source>" }, "-property:RestoreSources=<source>")]
[InlineData(new string[] { "-s", "<source0>", "-s", "<source1>" }, "-p:RestoreSources=<source0>%3B<source1>")] [InlineData(new string[] { "-s", "<source0>", "-s", "<source1>" }, "-property:RestoreSources=<source0>%3B<source1>")]
[InlineData(new string[] { "-r", "<runtime>" }, "-p:RuntimeIdentifiers=<runtime>")] [InlineData(new string[] { "-r", "<runtime>" }, "-property:RuntimeIdentifiers=<runtime>")]
[InlineData(new string[] { "--runtime", "<runtime>" }, "-p:RuntimeIdentifiers=<runtime>")] [InlineData(new string[] { "--runtime", "<runtime>" }, "-property:RuntimeIdentifiers=<runtime>")]
[InlineData(new string[] { "-r", "<runtime0>", "-r", "<runtime1>" }, "-p:RuntimeIdentifiers=<runtime0>%3B<runtime1>")] [InlineData(new string[] { "-r", "<runtime0>", "-r", "<runtime1>" }, "-property:RuntimeIdentifiers=<runtime0>%3B<runtime1>")]
[InlineData(new string[] { "--packages", "<packages>" }, "-p:RestorePackagesPath=<packages>")] [InlineData(new string[] { "--packages", "<packages>" }, "-property:RestorePackagesPath=<packages>")]
[InlineData(new string[] { "--disable-parallel" }, "-p:RestoreDisableParallel=true")] [InlineData(new string[] { "--disable-parallel" }, "-property:RestoreDisableParallel=true")]
[InlineData(new string[] { "--configfile", "<config>" }, "-p:RestoreConfigFile=<config>")] [InlineData(new string[] { "--configfile", "<config>" }, "-property:RestoreConfigFile=<config>")]
[InlineData(new string[] { "--no-cache" }, "-p:RestoreNoCache=true")] [InlineData(new string[] { "--no-cache" }, "-property:RestoreNoCache=true")]
[InlineData(new string[] { "--ignore-failed-sources" }, "-p:RestoreIgnoreFailedSources=true")] [InlineData(new string[] { "--ignore-failed-sources" }, "-property:RestoreIgnoreFailedSources=true")]
[InlineData(new string[] { "--no-dependencies" }, "-p:RestoreRecursive=false")] [InlineData(new string[] { "--no-dependencies" }, "-property: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)

View file

@ -11,8 +11,8 @@ 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> -maxcpucount -verbosity:m -target:ComposeStore <project>";
static readonly string[] ArgsPrefix = { "-m", "<project>" }; static readonly string[] ArgsPrefix = { "--manifest", "<project>" };
[Theory] [Theory]
[InlineData("-m")] [InlineData("-m")]
@ -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>" }, @"-property:TargetFramework=<tfm>")]
[InlineData(new string[] { "--framework", "<tfm>" }, @"-p:TargetFramework=<tfm>")] [InlineData(new string[] { "--framework", "<tfm>" }, @"-property:TargetFramework=<tfm>")]
[InlineData(new string[] { "-r", "<rid>" }, @"-p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "-r", "<rid>" }, @"-property:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--runtime", "<rid>" }, @"-p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "--runtime", "<rid>" }, @"-property: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" }, @"-property: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} -property:ComposeDir={Path.GetFullPath(path)}");
} }
} }
} }