Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 5b5d69c

Browse files
author
Yanchen Wu
committed
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.
1 parent 501e11d commit 5b5d69c

File tree

5 files changed

+56
-1
lines changed

5 files changed

+56
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.Docker.Sdk">
3+
<PropertyGroup Label="Globals">
4+
<ProjectVersion>2.0</ProjectVersion>
5+
<DockerTargetOS>Linux</DockerTargetOS>
6+
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
7+
<DockerServiceUrl>http://localhost:{ServicePort}</DockerServiceUrl>
8+
<DockerServiceName>testwebapplication</DockerServiceName>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<None Include="docker-compose.yml" />
12+
</ItemGroup>
13+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.0'
2+
3+
services:
4+
testwebapplication:
5+
image: testwebapplication
6+
build:
7+
context: .
8+
dockerfile: testwebapplication/Dockerfile

build/BundledSdks.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
<BundledSdk Include="Microsoft.NET.Sdk.Publish" Version="$(MicrosoftNETSdkPublishPackageVersion)" />
77
<BundledSdk Include="Microsoft.NET.Sdk.Web.ProjectSystem" Version="$(MicrosoftNETSdkWebProjectSystemPackageVersion)" />
88
<BundledSdk Include="FSharp.NET.Sdk" Version="1.0.4-bundled-0100" />
9+
<BundledSdk Include="Microsoft.Docker.Sdk" Version="1.1.0" />
910
</ItemGroup>
1011
</Project>

build/NugetConfigFile.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
<add key="vstest" value="https://dotnet.myget.org/F/vstest/api/v3/index.json" />
3131
<add key="web-api" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
3232
<add key="symreader-native" value="https://dotnet.myget.org/F/symreader-native/api/v3/index.json" />
33-
<add key="nuget-build" value="https://dotnet.myget.org/F/nuget-build/api/v3/index.json" />
33+
<add key="nuget-build" value="https://dotnet.myget.org/F/nuget-build/api/v3/index.json" />
34+
<add key="container-tools" value="https://www.myget.org/F/container-tools-for-visual-studio/api/v3/index.json" />
3435
]]>
3536
</NugetConfigCLIFeeds>
3637

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) .NET Foundation and contributors. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using FluentAssertions;
5+
using Microsoft.DotNet.Tools.Test.Utilities;
6+
using Xunit;
7+
8+
namespace Microsoft.DotNet.Cli.Build.Tests
9+
{
10+
public class GivenDotnetBuildBuildsDcproj : TestBase
11+
{
12+
[Fact]
13+
public void ItPrintsBuildSummary()
14+
{
15+
var testAppName = "docker-compose";
16+
var testInstance = TestAssets.Get(testAppName)
17+
.CreateInstance(testAppName)
18+
.WithSourceFiles()
19+
.WithRestoreFiles();
20+
21+
string expectedBuildSummary = @"Build succeeded.
22+
0 Warning(s)
23+
0 Error(s)";
24+
25+
var cmd = new BuildCommand()
26+
.WithWorkingDirectory(testInstance.Root)
27+
.ExecuteWithCapturedOutput();
28+
cmd.Should().Pass();
29+
cmd.StdOut.Should().ContainVisuallySameFragment(expectedBuildSummary);
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)