VS 2017 Add > Docker Support breaks build – “CleanWorkspace” task failed unexpectedly (console app)

First off I’m using .NET 4.6.1. Does Docker with VS 2017 not work with anything but .NET Core?

I used the new feature Add > Docker Support from the context menu, and it created a bunch of files. Here’s my Dockerfile (haven’t touched it since it was auto-created):

  • How to perform code analysis in sonarqube in docker in a ASP.NET web application
  • Can't build ASP.NET Core app that references PCL in docker
  • OpenCV error when Docker container is run on GKE
  • Identity Server 4 and docker
  • Compile .NET project in Docker using .csproj file
  • Visual Studio 2017 Docker project on Windows volumes issue
  • FROM microsoft/windowsservercore
    ARG source
    WORKDIR /app
    COPY ${source:-obj/Docker/publish} .
    ENTRYPOINT ["C:\app\nameofmyapp.exe"]
    

    When I build, I get the following error:

    The “CleanWorkspace” task failed unexpectedly.
    Microsoft.DotNet.Docker.CommandLineClientException: The Compose file
    ‘…\docker-compose.yml’
    is invalid because: services.pas.parsemicroservice.build.context
    contains null, which is an invalid type, it should be a string.

    Here’s my docker-compose.yml file:

    version: '2.1'
    
    services:
      pas.parsemicroservice:
        image: pas.parsemicroservice
        build:
          context: 
          dockerfile: Dockerfile
    

    If I add a . to context (as the error implies the null there is the problem), I get a different error:

    There is a circular dependency in the target dependency graph
    involving target “DockerCleanServiceReferences”.

    Is this all a result of using the wrong .NET framework, or are my files set up wrong? (I am a Docker n00b to be sure.)

  • Easy way to give docker container access to my local domains (.local, .dev)
  • docker-compose restart always not issuing run command
  • exited: scrapy (exit status 0; not expected)
  • How to detect fully interactive shell in bash from docker?
  • Kamon, Statsd, Grafana Disk Space
  • Is there a docker image which is similar (or the same) as AWS EC2 AMI?
  • One Solution collect form web for “VS 2017 Add > Docker Support breaks build – “CleanWorkspace” task failed unexpectedly (console app)”

    Update: Regarding your circular dependency issue, make sure your SLN and CSPROJ files are not in the same folder. Meaning that when you first create a solution, make sure to check the box that says “create directory for solution”.

    Docker support for non .Net Core applications is definitely supported in VS 2017 as shown at the 9:15 mark of this video https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2017-Launch/T111

    Your context should point to the directory where your Dockerfile exists. This path should be relative to where your docker-compose.yml file is located.

    Compose file version 2 Reference: https://docs.docker.com/compose/compose-file/compose-file-v2/#context

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.