diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index 23ddd8a51..3715f30ab 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26206.0 @@ -24,47 +24,50 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestPackages", "TestPackage EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{89905EC4-BC0F-443B-8ADF-691321F10108}" ProjectSection(SolutionItems) = preProject - build\Microsoft.DotNet.Cli.Branding.props = build\Microsoft.DotNet.Cli.Branding.props - build\Microsoft.DotNet.Cli.BranchInfo.props = build\Microsoft.DotNet.Cli.BranchInfo.props - build\Microsoft.DotNet.Cli.BundledSdks.proj = build\Microsoft.DotNet.Cli.BundledSdks.proj - build\Microsoft.DotNet.Cli.BundledSdks.props = build\Microsoft.DotNet.Cli.BundledSdks.props - build\Microsoft.DotNet.Cli.BundledTemplates.proj = build\Microsoft.DotNet.Cli.BundledTemplates.proj - build\Microsoft.DotNet.Cli.BundledTemplates.props = build\Microsoft.DotNet.Cli.BundledTemplates.props - build\Microsoft.DotNet.Cli.Compile.targets = build\Microsoft.DotNet.Cli.Compile.targets - build\Microsoft.DotNet.Cli.DependencyVersions.props = build\Microsoft.DotNet.Cli.DependencyVersions.props - build\Microsoft.DotNet.Cli.FileExtensions.props = build\Microsoft.DotNet.Cli.FileExtensions.props - build\Microsoft.DotNet.Cli.GitCommitInfo.targets = build\Microsoft.DotNet.Cli.GitCommitInfo.targets - build\Microsoft.DotNet.Cli.HostInfo.targets = build\Microsoft.DotNet.Cli.HostInfo.targets - build\Microsoft.DotNet.Cli.InitRepo.props = build\Microsoft.DotNet.Cli.InitRepo.props - build\Microsoft.DotNet.Cli.InitRepo.targets = build\Microsoft.DotNet.Cli.InitRepo.targets - build\Microsoft.DotNet.Cli.Monikers.props = build\Microsoft.DotNet.Cli.Monikers.props - build\Microsoft.DotNet.Cli.OutputDirectories.props = build\Microsoft.DotNet.Cli.OutputDirectories.props - build\Microsoft.DotNet.Cli.Package.targets = build\Microsoft.DotNet.Cli.Package.targets - build\Microsoft.DotNet.Cli.Prepare.targets = build\Microsoft.DotNet.Cli.Prepare.targets - build\Microsoft.DotNet.Cli.Publish.targets = build\Microsoft.DotNet.Cli.Publish.targets - build\Microsoft.DotNet.Cli.Run.targets = build\Microsoft.DotNet.Cli.Run.targets - build\Microsoft.DotNet.Cli.Signing.proj = build\Microsoft.DotNet.Cli.Signing.proj - build\Microsoft.DotNet.Cli.Stage0.props = build\Microsoft.DotNet.Cli.Stage0.props - build\Microsoft.DotNet.Cli.tasks = build\Microsoft.DotNet.Cli.tasks - build\Microsoft.DotNet.Cli.Test.targets = build\Microsoft.DotNet.Cli.Test.targets - build\Microsoft.DotNet.Cli.Version.props = build\Microsoft.DotNet.Cli.Version.props - build\Microsoft.DotNet.Cli.VersionBadge.props = build\Microsoft.DotNet.Cli.VersionBadge.props + build\Branding.props = build\Branding.props + build\BranchInfo.props = build\BranchInfo.props + build\BuildDefaults.props = build\BuildDefaults.props + build\BundledSdks.proj = build\BundledSdks.proj + build\BundledSdks.props = build\BundledSdks.props + build\BundledTemplates.proj = build\BundledTemplates.proj + build\BundledTemplates.props = build\BundledTemplates.props + build\Compile.targets = build\Compile.targets + build\CoreSetupInfo.props = build\CoreSetupInfo.props + build\DependencyVersions.props = build\DependencyVersions.props + build\FileExtensions.props = build\FileExtensions.props + build\GitCommitInfo.targets = build\GitCommitInfo.targets + build\HostInfo.targets = build\HostInfo.targets + build\InitRepo.props = build\InitRepo.props + build\InitRepo.targets = build\InitRepo.targets + build\InputDirectories.props = build\InputDirectories.props + build\Monikers.props = build\Monikers.props + build\OutputDirectories.props = build\OutputDirectories.props + build\Package.targets = build\Package.targets + build\Prepare.targets = build\Prepare.targets + build\Publish.targets = build\Publish.targets + build\Run.targets = build\Run.targets + build\Signing.proj = build\Signing.proj + build\Stage0.props = build\Stage0.props + build\tasks = build\tasks + build\Test.targets = build\Test.targets + build\Version.props = build\Version.props + build\VersionBadge.props = build\VersionBadge.props EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "package", "package", "{FD7D515A-D10F-4F49-B8AE-21CF7ED071AE}" ProjectSection(SolutionItems) = preProject - build\package\Microsoft.DotNet.Cli.Archive.targets = build\package\Microsoft.DotNet.Cli.Archive.targets - build\package\Microsoft.DotNet.Cli.Installer.DEB.proj = build\package\Microsoft.DotNet.Cli.Installer.DEB.proj - build\package\Microsoft.DotNet.Cli.Installer.DEB.targets = build\package\Microsoft.DotNet.Cli.Installer.DEB.targets - build\package\Microsoft.DotNet.Cli.Installer.MSI.targets = build\package\Microsoft.DotNet.Cli.Installer.MSI.targets - build\package\Microsoft.DotNet.Cli.Installer.PKG.targets = build\package\Microsoft.DotNet.Cli.Installer.PKG.targets - build\package\Microsoft.DotNet.Cli.Layout.targets = build\package\Microsoft.DotNet.Cli.Layout.targets - build\package\Microsoft.DotNet.Cli.Nupkg.targets = build\package\Microsoft.DotNet.Cli.Nupkg.targets + build\package\Archive.targets = build\package\Archive.targets + build\package\Installer.DEB.proj = build\package\Installer.DEB.proj + build\package\Installer.DEB.targets = build\package\Installer.DEB.targets + build\package\Installer.MSI.targets = build\package\Installer.MSI.targets + build\package\Installer.PKG.targets = build\package\Installer.PKG.targets + build\package\Layout.targets = build\package\Layout.targets + build\package\Nupkg.targets = build\package\Nupkg.targets EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "compile", "compile", "{8E3354BD-827F-41B7-9EE6-6BE1F1EDD8E9}" ProjectSection(SolutionItems) = preProject - build\compile\Microsoft.DotNet.Cli.LzmaArchive.targets = build\compile\Microsoft.DotNet.Cli.LzmaArchive.targets + build\compile\LzmaArchive.targets = build\compile\LzmaArchive.targets EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{FF498306-2DE2-47F6-8C35-3CF0589CF2B8}" @@ -78,8 +81,8 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "publish", "publish", "{27B12960-ABB0-4903-9C60-5E9157E659C8}" ProjectSection(SolutionItems) = preProject build\publish\FinishBuild.targets = build\publish\FinishBuild.targets - build\publish\Microsoft.DotNet.Cli.Badge.targets = build\publish\Microsoft.DotNet.Cli.Badge.targets - build\publish\Microsoft.DotNet.Cli.Checksum.targets = build\publish\Microsoft.DotNet.Cli.Checksum.targets + build\publish\Badge.targets = build\publish\Badge.targets + build\publish\Checksum.targets = build\publish\Checksum.targets build\publish\PublishContent.targets = build\publish\PublishContent.targets EndProjectSection EndProject @@ -87,7 +90,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-cli-build", "build_p EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "crossgen", "crossgen", "{19AC02B7-6D2C-4C2B-A410-9D4A59CE0E47}" ProjectSection(SolutionItems) = preProject - build\crossgen\Microsoft.DotNet.Cli.Crossgen.targets = build\crossgen\Microsoft.DotNet.Cli.Crossgen.targets + build\crossgen\Crossgen.targets = build\crossgen\Crossgen.targets EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "prepare", "prepare", "{2BDC1BC2-867E-47C0-BAD0-ADE897F07F78}" @@ -206,6 +209,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.Cli.Sln.In EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.Cli.Sln.Internal.Tests", "test\Microsoft.DotNet.Cli.Sln.Internal.Tests\Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj", "{56F1E090-B80F-4BDF-8991-4B0F9B5B8C9A}" EndProject +Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-cache.Tests", "test\dotnet-cache.Tests\dotnet-cache.Tests.csproj", "{CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1491,19 +1496,25 @@ Global {56F1E090-B80F-4BDF-8991-4B0F9B5B8C9A}.RelWithDebInfo|x64.Build.0 = Debug|x86 {56F1E090-B80F-4BDF-8991-4B0F9B5B8C9A}.RelWithDebInfo|x86.ActiveCfg = Debug|x86 {56F1E090-B80F-4BDF-8991-4B0F9B5B8C9A}.RelWithDebInfo|x86.Build.0 = Debug|x86 + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Debug|x64.ActiveCfg = Debug|x64 + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Debug|x64.Build.0 = Debug|x64 + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Debug|x86.ActiveCfg = Debug|x86 + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Debug|x86.Build.0 = Debug|x86 + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Release|Any CPU.Build.0 = Release|Any CPU + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Release|x64.ActiveCfg = Release|x64 + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Release|x64.Build.0 = Release|x64 + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Release|x86.ActiveCfg = Release|x86 + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {1AB5B24B-B317-4142-A5D1-A6E84F15BA34} = {ADA7052B-884B-4776-8B8D-D04191D0AA70} - {FD7D515A-D10F-4F49-B8AE-21CF7ED071AE} = {89905EC4-BC0F-443B-8ADF-691321F10108} - {8E3354BD-827F-41B7-9EE6-6BE1F1EDD8E9} = {89905EC4-BC0F-443B-8ADF-691321F10108} - {FF498306-2DE2-47F6-8C35-3CF0589CF2B8} = {89905EC4-BC0F-443B-8ADF-691321F10108} - {27B12960-ABB0-4903-9C60-5E9157E659C8} = {89905EC4-BC0F-443B-8ADF-691321F10108} {8A2FA2D8-0DA1-4814-B5C1-2ECEAA613EB1} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} - {19AC02B7-6D2C-4C2B-A410-9D4A59CE0E47} = {89905EC4-BC0F-443B-8ADF-691321F10108} - {2BDC1BC2-867E-47C0-BAD0-ADE897F07F78} = {89905EC4-BC0F-443B-8ADF-691321F10108} {48A62BA4-D798-46A2-AB49-8A8471CF8165} = {1AB5B24B-B317-4142-A5D1-A6E84F15BA34} {7C3D62C6-1D71-4C45-872F-7583F2AB304A} = {1AB5B24B-B317-4142-A5D1-A6E84F15BA34} {79B4932C-3D57-494B-95AF-E5624F9D2F01} = {1AB5B24B-B317-4142-A5D1-A6E84F15BA34} @@ -1558,5 +1569,6 @@ Global {F2D1A7DA-B3EB-4CA7-BAA9-A18CEC398853} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} {C98C7C2E-2C29-4A40-958C-60561ED77791} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {56F1E090-B80F-4BDF-8991-4B0F9B5B8C9A} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} + {CACA427D-5A71-45E6-88DC-3E2DB6C4D52D} = {FF498306-2DE2-47F6-8C35-3CF0589CF2B8} EndGlobalSection EndGlobal diff --git a/TestAssets/TestProjects/NewtonSoftDependentProject/NewtonSoftDependentProject.csproj b/TestAssets/TestProjects/NewtonSoftDependentProject/NewtonSoftDependentProject.csproj new file mode 100644 index 000000000..ad4e204c8 --- /dev/null +++ b/TestAssets/TestProjects/NewtonSoftDependentProject/NewtonSoftDependentProject.csproj @@ -0,0 +1,10 @@ + + + + Exe + netcoreapp2.0 + + + + + diff --git a/TestAssets/TestProjects/NewtonSoftDependentProject/Program.cs b/TestAssets/TestProjects/NewtonSoftDependentProject/Program.cs new file mode 100644 index 000000000..0e57f9b64 --- /dev/null +++ b/TestAssets/TestProjects/NewtonSoftDependentProject/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections; +using Newtonsoft.Json.Linq; + +class Program +{ + public static void Main(string[] args) + { + ArrayList argList = new ArrayList(args); + JObject jObject = new JObject(); + + foreach (string arg in argList) + { + jObject[arg] = arg; + } + + Console.WriteLine(jObject.ToString()); + } +} diff --git a/TestAssets/TestProjects/NewtonsoftFilterProfile/NewtonsoftFilterProfile.xml b/TestAssets/TestProjects/NewtonsoftFilterProfile/NewtonsoftFilterProfile.xml new file mode 100644 index 000000000..6cc6c5cdc --- /dev/null +++ b/TestAssets/TestProjects/NewtonsoftFilterProfile/NewtonsoftFilterProfile.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/build.proj b/build.proj index a9e76346a..54372ad1c 100644 --- a/build.proj +++ b/build.proj @@ -2,33 +2,6 @@ - - - powershell -NoProfile -NoLogo -Command - - - .ps1 - .sh - - Prepare;Compile;Test;Package;Publish - - Debug - - master - Microsoft.NETCore.App - $(CLI_SharedFrameworkVersion) - $(CLI_SharedFrameworkVersion) - $(CLI_SharedFrameworkVersion) - - .exe - - - $(RepoRoot)/build_projects/dotnet-cli-build - $(RepoRoot)/.nuget - - diff --git a/build/Branding.props b/build/Branding.props index f707fe578..21ae2d473 100644 --- a/build/Branding.props +++ b/build/Branding.props @@ -9,7 +9,8 @@ Microsoft .NET Core 1.0.1 - Host Microsoft .NET Core 1.0.1 - Host FX Resolver - Microsoft.NETCore.App + Microsoft.NETCore.App + $(SharedFrameworkName) $(Rid) $(OSName)-$(Architecture) diff --git a/build/BuildDefaults.props b/build/BuildDefaults.props new file mode 100644 index 000000000..1bd2a7960 --- /dev/null +++ b/build/BuildDefaults.props @@ -0,0 +1,6 @@ + + + Prepare;Compile;Test;Package;Publish + Debug + + diff --git a/build/CoreSetupInfo.props b/build/CoreSetupInfo.props new file mode 100644 index 000000000..16d4628c2 --- /dev/null +++ b/build/CoreSetupInfo.props @@ -0,0 +1,5 @@ + + + master + + diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index ed16c72ee..f266ec79a 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -4,11 +4,14 @@ 2.0.0-beta-001509-00 15.2.0-preview-000002-01 2.0.0-rc4-61325-08 - 1.0.0-alpha-20170125-1 + 1.1.0-alpha-20170209-1 4.0.0-rc3-2193 1.0.0-alpha-20170130-3-281 15.0.0-preview-20170125-04 + $(CLI_SharedFrameworkVersion) + $(CLI_SharedFrameworkVersion) + $(CLI_SharedFrameworkVersion) 1.0.0-beta1-20170202-111 1.0.0-beta1-20170131-110 1.0.0-beta1-20170209-117 diff --git a/build/FileExtensions.props b/build/FileExtensions.props index ccd299a33..210287ae0 100644 --- a/build/FileExtensions.props +++ b/build/FileExtensions.props @@ -19,5 +19,11 @@ .dll .dylib + .exe + + + .ps1 + .sh + diff --git a/build/InputDirectories.props b/build/InputDirectories.props new file mode 100644 index 000000000..bbb344d0a --- /dev/null +++ b/build/InputDirectories.props @@ -0,0 +1,5 @@ + + + $(RepoRoot)/build_projects/dotnet-cli-build + + diff --git a/dir.props b/dir.props index be4bb5d6f..ff69de344 100644 --- a/dir.props +++ b/dir.props @@ -9,10 +9,13 @@ + + + diff --git a/src/Microsoft.DotNet.TestFramework/TestAssetInstance.cs b/src/Microsoft.DotNet.TestFramework/TestAssetInstance.cs index bb3ad0899..dadbdf01e 100644 --- a/src/Microsoft.DotNet.TestFramework/TestAssetInstance.cs +++ b/src/Microsoft.DotNet.TestFramework/TestAssetInstance.cs @@ -29,6 +29,8 @@ namespace Microsoft.DotNet.TestFramework private bool _built = false; + public static string CurrentRuntimeFrameworkVersion = new Muxer().SharedFxVersion; + public TestAssetInstance(TestAssetInfo testAssetInfo, DirectoryInfo root) { if (testAssetInfo == null) @@ -170,7 +172,7 @@ namespace Microsoft.DotNet.TestFramework project.Root.Add(propertyGroup); } - propertyGroup.Add(new XElement(ns + "RuntimeFrameworkVersion", new Muxer().SharedFxVersion)); + propertyGroup.Add(new XElement(ns + "RuntimeFrameworkVersion", CurrentRuntimeFrameworkVersion)); }); } diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index 63119cdba..34a00a128 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -27,6 +27,7 @@ using Microsoft.DotNet.Tools.Run; using Microsoft.DotNet.Tools.Sln; using Microsoft.DotNet.Tools.Test; using Microsoft.DotNet.Tools.VSTest; +using Microsoft.DotNet.Tools.Cache; using NuGet.Frameworks; namespace Microsoft.DotNet.Cli @@ -37,6 +38,7 @@ namespace Microsoft.DotNet.Cli { ["add"] = AddCommand.Run, ["build"] = BuildCommand.Run, + ["cache"] = CacheCommand.Run, ["clean"] = CleanCommand.Run, ["help"] = HelpCommand.Run, ["list"] = ListCommand.Run, diff --git a/src/dotnet/commands/dotnet-cache/CacheCommand.cs b/src/dotnet/commands/dotnet-cache/CacheCommand.cs new file mode 100644 index 000000000..1691bb6e5 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/CacheCommand.cs @@ -0,0 +1,92 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Linq; +using System.Collections.Generic; +using System.IO; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Tools.MSBuild; +using Microsoft.DotNet.Tools.Restore; +using Microsoft.DotNet.Cli.CommandLine; + +namespace Microsoft.DotNet.Tools.Cache +{ + public partial class CacheCommand + { + public string ProjectArgument { get; set; } + public string Framework { get; set; } + public string Runtime { get; set; } + public string OutputPath { get; set; } + public string FrameworkVersion { get; set; } + public string IntermediateDir { get; set; } + public string Verbosity { get; set; } + private bool SkipOptimization { get; set; } + private bool PreserveIntermediateDir { get; set; } + + public List ExtraMSBuildArguments { get; set; } + + private CacheCommand() + { + } + + public int Execute() + { + var msbuildArgs = new List(); + + if (string.IsNullOrEmpty(ProjectArgument)) + { + throw new InvalidOperationException(LocalizableStrings.SpecifyEntries); + } + + msbuildArgs.Add("/t:ComposeCache"); + msbuildArgs.Add(ProjectArgument); + + if (!string.IsNullOrEmpty(Framework)) + { + msbuildArgs.Add($"/p:TargetFramework={Framework}"); + } + + if (!string.IsNullOrEmpty(Runtime)) + { + msbuildArgs.Add($"/p:RuntimeIdentifier={Runtime}"); + } + + if (!string.IsNullOrEmpty(OutputPath)) + { + OutputPath = Path.GetFullPath(OutputPath); + msbuildArgs.Add($"/p:ComposeDir={OutputPath}"); + } + + if (!string.IsNullOrEmpty(FrameworkVersion)) + { + msbuildArgs.Add($"/p:FX_Version={FrameworkVersion}"); + } + + if (!string.IsNullOrEmpty(IntermediateDir)) + { + msbuildArgs.Add($"/p:ComposeWorkingDir={IntermediateDir}"); + } + + if (SkipOptimization) + { + msbuildArgs.Add($"/p:SkipOptimization={SkipOptimization}"); + } + + if (PreserveIntermediateDir) + { + msbuildArgs.Add($"/p:PreserveComposeWorkingDir={PreserveIntermediateDir}"); + } + + if (!string.IsNullOrEmpty(Verbosity)) + { + msbuildArgs.Add($"/verbosity:{Verbosity}"); + } + + msbuildArgs.AddRange(ExtraMSBuildArguments); + + return new MSBuildForwardingApp(msbuildArgs).Execute(); + } + } +} + diff --git a/src/dotnet/commands/dotnet-cache/LocalizableStrings.cs b/src/dotnet/commands/dotnet-cache/LocalizableStrings.cs new file mode 100644 index 000000000..1d0e50970 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/LocalizableStrings.cs @@ -0,0 +1,41 @@ +namespace Microsoft.DotNet.Tools.Cache +{ + internal class LocalizableStrings + { + public const string AppFullName = ".NET Cache"; + + public const string AppDescription = "Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework."; + + public const string ProjectEntries = "ProjectEntries"; + + public const string ProjectEntryDescription = "The XML file that contains the list of packages to be cached."; + + public const string FrameworkOption = "FRAMEWORK"; + + public const string FrameworkOptionDescription = "Target framework for which to cache for."; + + public const string RuntimeOption = "RUNTIME_IDENTIFIER"; + + public const string RuntimeOptionDescription = "Target runtime to cache for."; + + public const string OutputOption = "OUTPUT_DIR"; + + public const string OutputOptionDescription = "Output directory in which to cache the given assemblies."; + + public const string FrameworkVersionOption = "FrameworkVersion"; + + public const string FrameworkVersionOptionDescription = "The Microsoft.NETCore.App package version that will be used to run the assemblies."; + + public const string SkipOptimizationOptionDescription = "Skips the optimization phase."; + + public const string IntermediateWorkingDirOption = "IntermediateWorkingDir"; + + public const string IntermediateWorkingDirOptionDescription = "The directory used by the command to execute."; + + public const string PreserveIntermediateWorkingDirOptionDescription = "Preserves the intermediate working directory."; + + public const string SpecifyEntries = "Specify at least one entry with --entries."; + + public const string IntermediateDirExists = "Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w."; + } +} diff --git a/src/dotnet/commands/dotnet-cache/Program.cs b/src/dotnet/commands/dotnet-cache/Program.cs new file mode 100644 index 000000000..3992fec48 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/Program.cs @@ -0,0 +1,80 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Tools.MSBuild; + +namespace Microsoft.DotNet.Tools.Cache +{ + public partial class CacheCommand + { + public static int Run(string[] args) + { + DebugHelper.HandleDebugSwitch(ref args); + + var app = new CommandLineApplication(throwOnUnexpectedArg: false); + app.Name = "dotnet cache"; + app.FullName = LocalizableStrings.AppFullName; + app.Description = LocalizableStrings.AppDescription; + app.AllowArgumentSeparator = true; + app.ArgumentSeparatorHelpText = HelpMessageStrings.MSBuildAdditionalArgsHelpText; + app.HelpOption("-h|--help"); + + CommandOption projectArgument = app.Option( + $"-e|--entries <{LocalizableStrings.ProjectEntries}>", LocalizableStrings.ProjectEntryDescription, + CommandOptionType.SingleValue); + + CommandOption frameworkOption = app.Option( + $"-f|--framework <{LocalizableStrings.FrameworkOption}>", LocalizableStrings.FrameworkOptionDescription, + CommandOptionType.SingleValue); + + CommandOption runtimeOption = app.Option( + $"-r|--runtime <{LocalizableStrings.RuntimeOption}>", LocalizableStrings.RuntimeOptionDescription, + CommandOptionType.SingleValue); + + CommandOption outputOption = app.Option( + $"-o|--output <{LocalizableStrings.OutputOption}>", LocalizableStrings.OutputOptionDescription, + CommandOptionType.SingleValue); + + CommandOption fxOption = app.Option( + $"--framework-version <{LocalizableStrings.FrameworkVersionOption}>", LocalizableStrings.FrameworkVersionOptionDescription, + CommandOptionType.SingleValue); + + CommandOption skipOptimizationOption = app.Option( + $"--skip-optimization", LocalizableStrings.SkipOptimizationOptionDescription, + CommandOptionType.NoValue); + + CommandOption workingDir = app.Option( + $"-w |--working-dir <{LocalizableStrings.IntermediateWorkingDirOption}>", LocalizableStrings.IntermediateWorkingDirOptionDescription, + CommandOptionType.SingleValue); + + CommandOption preserveWorkingDir = app.Option( + $"--preserve-working-dir", LocalizableStrings.PreserveIntermediateWorkingDirOptionDescription, + CommandOptionType.NoValue); + + CommandOption verbosityOption = MSBuildForwardingApp.AddVerbosityOption(app); + + app.OnExecute(() => + { + var cache = new CacheCommand(); + + cache.Framework = frameworkOption.Value(); + cache.Runtime = runtimeOption.Value(); + cache.OutputPath = outputOption.Value(); + cache.FrameworkVersion = fxOption.Value(); + cache.Verbosity = verbosityOption.Value(); + cache.SkipOptimization = skipOptimizationOption.HasValue(); + cache.IntermediateDir = workingDir.Value(); + cache.PreserveIntermediateDir = preserveWorkingDir.HasValue(); + cache.ExtraMSBuildArguments = app.RemainingArguments; + cache.ProjectArgument = projectArgument.Value(); + + return cache.Execute(); + }); + + return app.Execute(args); + } + } +} diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.cs.xlf new file mode 100644 index 000000000..f45d968a7 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.cs.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.de.xlf new file mode 100644 index 000000000..16e5443be --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.de.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.es.xlf new file mode 100644 index 000000000..c049192f5 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.es.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.fr.xlf new file mode 100644 index 000000000..3ef25bc4e --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.fr.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.it.xlf new file mode 100644 index 000000000..088a2311c --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.it.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.ja.xlf new file mode 100644 index 000000000..0202dcc57 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.ja.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.ko.xlf new file mode 100644 index 000000000..86192e70e --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.ko.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.pl.xlf new file mode 100644 index 000000000..dd9fc1e68 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.pl.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.pt-BR.xlf new file mode 100644 index 000000000..922f84b4d --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.pt-BR.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.ru.xlf new file mode 100644 index 000000000..a9bbfdc18 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.ru.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.tr.xlf new file mode 100644 index 000000000..409c5dd94 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.tr.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.xlf new file mode 100644 index 000000000..2ee6951d4 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.xlf @@ -0,0 +1,80 @@ + + + + + + + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + + + + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + + + + FRAMEWORK + + + + Target framework for which to cache for. + + + + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + + + + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + + + + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + + + + IntermediateWorkingDir + + + + The directory used by the command to execute. + + + + Preserves the intermediate working directory. + + + + Specify at least one entry with --entries. + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + + + + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.zh-Hans.xlf new file mode 100644 index 000000000..73966975c --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.zh-Hans.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.zh-Hant.xlf new file mode 100644 index 000000000..9e5a5a050 --- /dev/null +++ b/src/dotnet/commands/dotnet-cache/xlf/LocalizableStrings.zh-Hant.xlf @@ -0,0 +1,98 @@ + + + + + + + .NET Cache + .NET Cache + + + + Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. + Cahes Assemblies specified for the .NET Platform + + + + ProjectEntries + ProjectEntries + + + + The XML file that contains the list of packages to be cached. + The MSBuild project file used to specify the list of packages to be cached. + + + + FRAMEWORK + FRAMEWORK + + + + Target framework for which to cache for. + Target framework for which to cache for + + + + RUNTIME_IDENTIFIER + RUNTIME_IDENTIFIER + + + + Target runtime to cache for. + Target runtime to cache for. + + + + OUTPUT_DIR + OUTPUT_DIR + + + + Output directory in which to cache the given assemblies. + Path in which to cache the given assemblies + + + + FrameworkVersion + FrameworkVersion + + + + The Microsoft.NETCore.App package version that will be used to run the assemblies. + The Microsoft.NETCore.App package version that will be used to run the assemblies + + + + IntermediateWorkingDir + IntermediateWorkingDir + + + + The directory used by the command to execute. + The directory used by the command to do its work + + + + Preserves the intermediate working directory. + The directory used by the command to do its work will not be removed + + + + Specify at least one entry with --entries. + Please specify atleast one entry with --entries + + + + Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w. + Intermediate working directory {0} exists, remove {0} or specify another directory with -w + + + + Skips the optimization phase. + Skips the optimization phase. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/LocalizableStrings.cs b/src/dotnet/commands/dotnet-publish/LocalizableStrings.cs index cb81b0e3f..c62500216 100644 --- a/src/dotnet/commands/dotnet-publish/LocalizableStrings.cs +++ b/src/dotnet/commands/dotnet-publish/LocalizableStrings.cs @@ -29,5 +29,9 @@ public const string VersionSuffixOption = "VERSION_SUFFIX"; public const string VersionSuffixOptionDescription = "Defines the value for the $(VersionSuffix) property in the project."; + + public const string FilterProjOption = "profile.xml"; + + public const string FilterProjOptionDescription = "The XML file that contains the list of packages to be excluded from publish step."; } } diff --git a/src/dotnet/commands/dotnet-publish/Program.cs b/src/dotnet/commands/dotnet-publish/Program.cs index 9fdfcf62d..cfaef0043 100644 --- a/src/dotnet/commands/dotnet-publish/Program.cs +++ b/src/dotnet/commands/dotnet-publish/Program.cs @@ -43,6 +43,11 @@ namespace Microsoft.DotNet.Tools.Publish CommandOption versionSuffixOption = app.Option( $"--version-suffix <{LocalizableStrings.VersionSuffixOption}>", LocalizableStrings.VersionSuffixOptionDescription, CommandOptionType.SingleValue); + + CommandOption filterProjOption = app.Option( + $"--filter <{LocalizableStrings.FilterProjOption}>", LocalizableStrings.FilterProjOptionDescription, + CommandOptionType.SingleValue); + CommandOption verbosityOption = MSBuildForwardingApp.AddVerbosityOption(app); app.OnExecute(() => @@ -55,6 +60,7 @@ namespace Microsoft.DotNet.Tools.Publish publish.OutputPath = outputOption.Value(); publish.Configuration = configurationOption.Value(); publish.VersionSuffix = versionSuffixOption.Value(); + publish.FilterProject = filterProjOption.Value(); publish.Verbosity = verbosityOption.Value(); publish.ExtraMSBuildArguments = app.RemainingArguments; diff --git a/src/dotnet/commands/dotnet-publish/PublishCommand.cs b/src/dotnet/commands/dotnet-publish/PublishCommand.cs index 2ce171fb8..767092bde 100644 --- a/src/dotnet/commands/dotnet-publish/PublishCommand.cs +++ b/src/dotnet/commands/dotnet-publish/PublishCommand.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.Linq; using System.Collections.Generic; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools.MSBuild; @@ -16,6 +17,7 @@ namespace Microsoft.DotNet.Tools.Publish public string OutputPath { get; set; } public string Configuration { get; set; } public string VersionSuffix { get; set; } + public string FilterProject { get; set; } public string Verbosity { get; set; } public List ExtraMSBuildArguments { get; set; } @@ -60,6 +62,11 @@ namespace Microsoft.DotNet.Tools.Publish msbuildArgs.Add($"/p:VersionSuffix={VersionSuffix}"); } + if (!string.IsNullOrEmpty(FilterProject)) + { + msbuildArgs.Add($"/p:FilterProjFile={FilterProject}"); + } + if (!string.IsNullOrEmpty(Verbosity)) { msbuildArgs.Add($"/verbosity:{Verbosity}"); diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf index 73f3f302a..edb082e5f 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.cs.xlf @@ -73,6 +73,16 @@ Definuje hodnotu vlastnosti $(VersionSuffix) v projektu. + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf index 93df352a4..496046453 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf @@ -73,6 +73,16 @@ Definiert den Wert für die Eigenschaft "$(VersionSuffix)" im Projekt. + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf index 1dca753ff..af51f92f3 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.es.xlf @@ -73,6 +73,16 @@ Define el valor para la propiedad $(VersionSuffix) del proyecto. + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf index 721bb3e54..c9d898451 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.fr.xlf @@ -73,6 +73,16 @@ Définit la valeur de la propriété $(VersionSuffix) dans le projet. + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf index 087f96628..7c2236a93 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.it.xlf @@ -73,6 +73,16 @@ Consente di definire il valore per la proprietà $(VersionSuffix) nel progetto. + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf index 95772bb63..a863c7066 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ja.xlf @@ -73,6 +73,16 @@ プロジェクトの $(VersionSuffix) プロパティの値を定義します。 + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf index cc986ead3..a65462ebf 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ko.xlf @@ -73,6 +73,16 @@ 프로젝트에서 $(VersionSuffix) 속성의 값을 정의합니다. + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf index 97b2afcb8..e828f5e4f 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pl.xlf @@ -73,6 +73,16 @@ Określa wartość właściwości $(VersionSuffix) w projekcie. + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf index 5abf38005..e59daec64 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.pt-BR.xlf @@ -73,6 +73,16 @@ Define o valor da propriedade $(VersionSuffix) no projeto. + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf index f91a6f3e3..7940d7364 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.ru.xlf @@ -73,6 +73,16 @@ Определяет значение для свойства $(VersionSuffix) в проекте. + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf index 6f5694480..16a912240 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.tr.xlf @@ -73,6 +73,16 @@ Projedeki $(VersionSuffix) özelliğinin değerini tanımlar. + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.xlf index a84fa9582..2576f0f7e 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.xlf @@ -59,6 +59,14 @@ Defines the value for the $(VersionSuffix) property in the project. + + profile.xml + + + + The XML file that contains the list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf index 96c1c403c..182693049 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hans.xlf @@ -73,6 +73,16 @@ 定义项目中 $(VersionSuffix) 属性的值。 + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf index dc3b69f9a..c6dd013d2 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.zh-Hant.xlf @@ -73,6 +73,16 @@ 在專案中定義 $(VersionSuffix) 屬性的值。 + + profile.xml + profile.proj + + + + The XML file that contains the list of packages to be excluded from publish step. + The list of packages to be excluded from publish step. + + \ No newline at end of file diff --git a/test/Microsoft.DotNet.Cli.Tests.sln b/test/Microsoft.DotNet.Cli.Tests.sln index dd933551d..69880af56 100644 --- a/test/Microsoft.DotNet.Cli.Tests.sln +++ b/test/Microsoft.DotNet.Cli.Tests.sln @@ -72,6 +72,8 @@ Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-sln-remove.Tests", " EndProject Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-add-package.Tests", "dotnet-add-package.Tests\dotnet-add-package.Tests.csproj", "{3501AB72-3E05-45EE-9000-9515F5A139AC}" EndProject +Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-cache.Tests", "dotnet-cache.Tests\dotnet-cache.Tests.csproj", "{7CA9ECD0-9284-496B-890F-94B63ECB37EC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -242,6 +244,18 @@ Global {3501AB72-3E05-45EE-9000-9515F5A139AC}.Release|x64.Build.0 = Release|x64 {3501AB72-3E05-45EE-9000-9515F5A139AC}.Release|x86.ActiveCfg = Release|x86 {3501AB72-3E05-45EE-9000-9515F5A139AC}.Release|x86.Build.0 = Release|x86 + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|x64.ActiveCfg = Debug|x64 + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|x64.Build.0 = Debug|x64 + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|x86.ActiveCfg = Debug|x86 + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|x86.Build.0 = Debug|x86 + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Release|Any CPU.Build.0 = Release|Any CPU + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Release|x64.ActiveCfg = Release|x64 + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Release|x64.Build.0 = Release|x64 + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Release|x86.ActiveCfg = Release|x86 + {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CacheCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CacheCommand.cs new file mode 100644 index 000000000..7cfbd65c1 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CacheCommand.cs @@ -0,0 +1,98 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.DotNet.Cli.Utils; +using NuGet.Frameworks; + +namespace Microsoft.DotNet.Tools.Test.Utilities +{ + public sealed class CacheCommand : TestCommand + { + private string _profileProject; + private string _framework; + private string _output; + private string _runtime; + private string _frameworkVersion; + private string _intermediateWorkingDirectory; + + public CacheCommand() + : base("dotnet") + { + } + + public CacheCommand WithEntries(string profileProject) + { + _profileProject = profileProject; + return this; + } + public CacheCommand WithFramework(string framework) + { + _framework = framework; + return this; + } + + public CacheCommand WithFramework(NuGetFramework framework) + { + return WithFramework(framework.GetShortFolderName()); + } + + public CacheCommand WithOutput(string output) + { + _output = output; + return this; + } + + public CacheCommand WithRuntime(string runtime) + { + _runtime = runtime; + return this; + } + + public CacheCommand WithRuntimeFrameworkVersion(string frameworkVersion) + { + _frameworkVersion = frameworkVersion; + return this; + } + + public CacheCommand WithIntermediateWorkingDirectory(string intermediateWorkingDirectory) + { + _intermediateWorkingDirectory = intermediateWorkingDirectory; + return this; + } + + public override CommandResult Execute(string args = "") + { + args = $"cache {BuildArgs()} {args}"; + return base.Execute(args); + } + + public override CommandResult ExecuteWithCapturedOutput(string args = "") + { + args = $"cache {BuildArgs()} {args}"; + return base.ExecuteWithCapturedOutput(args); + } + + private string BuildArgs() + { + return string.Join(" ", + ProfileProjectOption, + FrameworkOption, + OutputOption, + IntermediateWorkingDirectoryOption, + RuntimeOption, + FrameworkVersionOption); + } + + private string ProfileProjectOption => string.IsNullOrEmpty(_profileProject) ? "" : $"--entries {_profileProject}"; + + private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}"; + + private string OutputOption => string.IsNullOrEmpty(_output) ? "" : $"-o {_output}"; + + private string RuntimeOption => string.IsNullOrEmpty(_runtime) ? "" : $"-r {_runtime}"; + + private string FrameworkVersionOption => string.IsNullOrEmpty(_frameworkVersion) ? "" : $" --framework-version {_frameworkVersion}"; + + private string IntermediateWorkingDirectoryOption => string.IsNullOrEmpty(_intermediateWorkingDirectory)? "" : $" -w {_intermediateWorkingDirectory}"; + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs index 4a7d2049f..3a389d5c4 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs @@ -11,6 +11,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities private string _framework; private string _output; private string _runtime; + private string _profileproj; public PublishCommand() : base("dotnet") @@ -40,6 +41,12 @@ namespace Microsoft.DotNet.Tools.Test.Utilities return this; } + public PublishCommand WithProFileProject(string profileproj) + { + _profileproj = profileproj; + return this; + } + public override CommandResult Execute(string args = "") { args = $"publish {BuildArgs()} {args}"; @@ -57,6 +64,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities return string.Join(" ", FrameworkOption, OutputOption, + ProfileProjOption, RuntimeOption); } @@ -65,5 +73,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities private string OutputOption => string.IsNullOrEmpty(_output) ? "" : $"-o {_output}"; private string RuntimeOption => string.IsNullOrEmpty(_runtime) ? "" : $"-r {_runtime}"; + + private string ProfileProjOption => string.IsNullOrEmpty(_profileproj) ? "" : $"--filter {_profileproj}"; } } diff --git a/test/dotnet-cache.Tests/GivenDotnetCachesAndPublishesProjects.cs b/test/dotnet-cache.Tests/GivenDotnetCachesAndPublishesProjects.cs new file mode 100644 index 000000000..d67584867 --- /dev/null +++ b/test/dotnet-cache.Tests/GivenDotnetCachesAndPublishesProjects.cs @@ -0,0 +1,107 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.IO; +using System.Diagnostics; +using System.Runtime.InteropServices; +using FluentAssertions; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.PlatformAbstractions; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace Microsoft.DotNet.Cli.Publish.Tests +{ + public class GivenDotnetPublishPublisheswithCacheProjects : TestBase + { + private static string _tfm = "netcoreapp2.0"; + private static string _frameworkVersion = Microsoft.DotNet.TestFramework.TestAssetInstance.CurrentRuntimeFrameworkVersion; + + [Fact] + public void ItPublishesARunnablePortableApp() + { + var testAppName = "NewtonSoftDependentProject"; + var profileProjectName = "NewtonsoftFilterProfile"; + + var testInstance = TestAssets.Get(testAppName) + .CreateInstance() + .WithSourceFiles() + .UseCurrentRuntimeFrameworkVersion(); + + var testProjectDirectory = testInstance.Root.ToString(); + var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); + var localAssemblyCache = Path.Combine(testProjectDirectory, "localAssemblyCache"); + var intermediateWorkingDirectory = Path.Combine(testProjectDirectory, "workingDirectory"); + var profileProject = Path.Combine(TestAssetsManager.AssetsRoot, profileProjectName, $"{profileProjectName}.xml"); + + new RestoreCommand() + .WithWorkingDirectory(testProjectDirectory) + .Execute() + .Should().Pass(); + + new CacheCommand() + .WithEntries(profileProject) + .WithFramework(_tfm) + .WithRuntime(rid) + .WithOutput(localAssemblyCache) + .WithRuntimeFrameworkVersion(_frameworkVersion) + .WithIntermediateWorkingDirectory(intermediateWorkingDirectory) + .Execute($"--preserve-working-dir") + .Should().Pass(); + + var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; + + new PublishCommand() + .WithFramework(_tfm) + .WithWorkingDirectory(testProjectDirectory) + .WithProFileProject(profileProject) + .Execute() + .Should().Pass(); + + var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, _tfm, "publish", $"{testAppName}.dll"); + + new TestCommand("dotnet") + .WithEnvironmentVariable("DOTNET_SHARED_PACKAGES", localAssemblyCache) + .ExecuteWithCapturedOutput(outputDll) + .Should().Pass() + .And.HaveStdOutContaining("{}"); + } + + [Fact] + public void AppFailsDueToMissingCache() + { + var testAppName = "NewtonSoftDependentProject"; + var profileProjectName = "NewtonsoftFilterProfile"; + + var testInstance = TestAssets.Get(testAppName) + .CreateInstance() + .WithSourceFiles() + .UseCurrentRuntimeFrameworkVersion(); + + var testProjectDirectory = testInstance.Root.ToString(); + var profileProject = Path.Combine(TestAssetsManager.AssetsRoot, profileProjectName, $"{profileProjectName}.xml"); + + new RestoreCommand() + .WithWorkingDirectory(testProjectDirectory) + .Execute() + .Should().Pass(); + + var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; + + new PublishCommand() + .WithFramework(_tfm) + .WithWorkingDirectory(testProjectDirectory) + .WithProFileProject(profileProject) + .Execute() + .Should().Pass(); + + var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, _tfm, "publish", $"{testAppName}.dll"); + + new TestCommand("dotnet") + .ExecuteWithCapturedOutput(outputDll) + .Should().Fail() + .And.HaveStdErrContaining("assembly specified in the dependencies manifest was not found -- package: 'newtonsoft.json',"); + } + } +} diff --git a/test/dotnet-cache.Tests/dotnet-cache.Tests.csproj b/test/dotnet-cache.Tests/dotnet-cache.Tests.csproj new file mode 100644 index 000000000..02a1e5bb9 --- /dev/null +++ b/test/dotnet-cache.Tests/dotnet-cache.Tests.csproj @@ -0,0 +1,33 @@ + + + + + $(CliTargetFramework) + $(CLI_SharedFrameworkVersion) + true + dotnet-cache.Tests + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + + + + + + + + + + + + + + + 15.0.0-preview-20161024-02 + + + 2.2.0-beta4-build1194 + + + 2.2.0-beta4-build3444 + + +