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:
parent
501e11d928
commit
5b5d69c95d
5 changed files with 56 additions and 1 deletions
13
TestAssets/TestProjects/docker-compose/docker-compose.dcproj
Normal file
13
TestAssets/TestProjects/docker-compose/docker-compose.dcproj
Normal 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>
|
|
@ -0,0 +1,8 @@
|
||||||
|
version: '3.0'
|
||||||
|
|
||||||
|
services:
|
||||||
|
testwebapplication:
|
||||||
|
image: testwebapplication
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: testwebapplication/Dockerfile
|
|
@ -6,5 +6,6 @@
|
||||||
<BundledSdk Include="Microsoft.NET.Sdk.Publish" Version="$(MicrosoftNETSdkPublishPackageVersion)" />
|
<BundledSdk Include="Microsoft.NET.Sdk.Publish" Version="$(MicrosoftNETSdkPublishPackageVersion)" />
|
||||||
<BundledSdk Include="Microsoft.NET.Sdk.Web.ProjectSystem" Version="$(MicrosoftNETSdkWebProjectSystemPackageVersion)" />
|
<BundledSdk Include="Microsoft.NET.Sdk.Web.ProjectSystem" Version="$(MicrosoftNETSdkWebProjectSystemPackageVersion)" />
|
||||||
<BundledSdk Include="FSharp.NET.Sdk" Version="1.0.4-bundled-0100" />
|
<BundledSdk Include="FSharp.NET.Sdk" Version="1.0.4-bundled-0100" />
|
||||||
|
<BundledSdk Include="Microsoft.Docker.Sdk" Version="1.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
<add key="vstest" value="https://dotnet.myget.org/F/vstest/api/v3/index.json" />
|
<add key="vstest" value="https://dotnet.myget.org/F/vstest/api/v3/index.json" />
|
||||||
<add key="web-api" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
|
<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="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="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>
|
</NugetConfigCLIFeeds>
|
||||||
|
|
||||||
|
|
32
test/dotnet-build.Tests/GivenDotnetBuildBuildsDcproj.cs
Normal file
32
test/dotnet-build.Tests/GivenDotnetBuildBuildsDcproj.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue