Merge pull request #4237 from eerhardt/PublishCommand
Add `dotnet publish3` command
This commit is contained in:
commit
5434c7f392
10 changed files with 229 additions and 3 deletions
|
@ -0,0 +1,27 @@
|
|||
// 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;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public sealed class Publish3Command : TestCommand
|
||||
{
|
||||
public Publish3Command()
|
||||
: base("dotnet")
|
||||
{
|
||||
}
|
||||
|
||||
public override CommandResult Execute(string args = "")
|
||||
{
|
||||
args = $"publish3 {args}";
|
||||
return base.Execute(args);
|
||||
}
|
||||
|
||||
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
||||
{
|
||||
args = $"publish3 {args}";
|
||||
return base.ExecuteWithCapturedOutput(args);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ using FluentAssertions;
|
|||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build3.Tests
|
||||
namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
||||
{
|
||||
public class GivenDotnetMSBuildBuildsProjects : TestBase
|
||||
{
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
// 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 FluentAssertions;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Publish3.Tests
|
||||
{
|
||||
public class GivenDotnetPublish3PublishesProjects : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ItPublishesARunnablePortableApp()
|
||||
{
|
||||
var testAppName = "MSBuildTestApp";
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance(testAppName)
|
||||
.WithLockFiles();
|
||||
|
||||
var testProjectDirectory = testInstance.TestRoot;
|
||||
|
||||
new Publish3Command()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.Execute()
|
||||
.Should()
|
||||
.Pass();
|
||||
|
||||
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
|
||||
var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0", "publish", $"{testAppName}.dll");
|
||||
|
||||
new TestCommand("dotnet")
|
||||
.ExecuteWithCapturedOutput(outputDll)
|
||||
.Should()
|
||||
.Pass()
|
||||
.And
|
||||
.HaveStdOutContaining("Hello World");
|
||||
}
|
||||
}
|
||||
}
|
21
test/dotnet-publish3.Tests/dotnet-publish3.Tests.xproj
Normal file
21
test/dotnet-publish3.Tests/dotnet-publish3.Tests.xproj
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>fbe4f1d6-ba4c-46d9-8286-4ee4b032d01e</ProjectGuid>
|
||||
<RootNamespace>Microsoft.DotNet.Cli.Publish3.Tests</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
24
test/dotnet-publish3.Tests/project.json
Normal file
24
test/dotnet-publish3.Tests/project.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.1"
|
||||
},
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"Microsoft.DotNet.Tools.Tests.Utilities": {
|
||||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-350904-49"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"imports": [
|
||||
"dotnet5.4",
|
||||
"portable-net451+win8"
|
||||
]
|
||||
}
|
||||
},
|
||||
"testRunner": "xunit"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue