Reputation: 177
ASP.NET Core 2 project with docker support added in VS 2017, runs fine locally but build fails in VSTS build with following error:
2018-06-29T16:07:50.4095117Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(151,5): Error : The project version '2.0' is not supported by the current Visual Studio Tools for Containers.
I am trying to build in Team Services and release to an App Service for Containers in Azure.
docker-compose.dcproj contents:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectVersion>2.0</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>cc9f4ebc-dd9f-4592-9533-b4954b467670</ProjectGuid>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
<DockerServiceUrl>http://localhost:{ServicePort}</DockerServiceUrl>
<DockerServiceName>status</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
Upvotes: 3
Views: 1464
Reputation: 38096
Since you are using Hosted VS2017 agent, it only has VS2017 installed and only the windows container for docker can be use. So please make below changes (as the shared example project for example):
Change docker-compose.dcproj
file
2.0
to 2.1
Linux
to Windows
Change docker-compose.yml
and docker-compose.override.yml
file
3
to 3.4
Then the project can build successful by Hosted VS2017 agent. And this is the modified project based on you shared.
BTW: you can also user private agent to build your project. If you can build successful locally, then use the private agent can mostly build the project successfully by VSTS build.
Upvotes: 9