Adds Microsoft.Docker.Sdk to CLI

This change is to add Sdk.props and Sdk.targets of Microsoft.Docker.Sdk
into CLI. This unblocks the scenario where a VS solution contains a few
.NET Core projects as well as a docker-compose.dcproj project and people
want to build the solution from command line with .NET Core CLI. With
the Sdk.props and Sdk.targets being present in CLI, building
docker-compose.dcproj becomes no-op so it won't block building the other
.NET Core projects.
This commit is contained in:
Yanchen Wu 2018-01-17 11:12:19 -08:00
parent 501e11d928
commit 5b5d69c95d
5 changed files with 56 additions and 1 deletions

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectVersion>2.0</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
<DockerServiceUrl>http://localhost:{ServicePort}</DockerServiceUrl>
<DockerServiceName>testwebapplication</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.yml" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,8 @@
version: '3.0'
services:
testwebapplication:
image: testwebapplication
build:
context: .
dockerfile: testwebapplication/Dockerfile

View file

@ -6,5 +6,6 @@
<BundledSdk Include="Microsoft.NET.Sdk.Publish" Version="$(MicrosoftNETSdkPublishPackageVersion)" />
<BundledSdk Include="Microsoft.NET.Sdk.Web.ProjectSystem" Version="$(MicrosoftNETSdkWebProjectSystemPackageVersion)" />
<BundledSdk Include="FSharp.NET.Sdk" Version="1.0.4-bundled-0100" />
<BundledSdk Include="Microsoft.Docker.Sdk" Version="1.1.0" />
</ItemGroup>
</Project>

View file

@ -31,6 +31,7 @@
<add key="web-api" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
<add key="symreader-native" value="https://dotnet.myget.org/F/symreader-native/api/v3/index.json" />
<add key="nuget-build" value="https://dotnet.myget.org/F/nuget-build/api/v3/index.json" />
<add key="container-tools" value="https://www.myget.org/F/container-tools-for-visual-studio/api/v3/index.json" />
]]>
</NugetConfigCLIFeeds>

View file

@ -0,0 +1,32 @@
// 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 FluentAssertions;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
namespace Microsoft.DotNet.Cli.Build.Tests
{
public class GivenDotnetBuildBuildsDcproj : TestBase
{
[Fact]
public void ItPrintsBuildSummary()
{
var testAppName = "docker-compose";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance(testAppName)
.WithSourceFiles()
.WithRestoreFiles();
string expectedBuildSummary = @"Build succeeded.
0 Warning(s)
0 Error(s)";
var cmd = new BuildCommand()
.WithWorkingDirectory(testInstance.Root)
.ExecuteWithCapturedOutput();
cmd.Should().Pass();
cmd.StdOut.Should().ContainVisuallySameFragment(expectedBuildSummary);
}
}
}