Visual Studio容器工具要求Docker在构建,调试或运行容器化项目之前运行

Visual Studio容器工具要求Docker在构建,调试或运行容器化项目之前运行

问题描述:

我正在研究.Net核心微服务.我安装了包含docker cli和kitematics的Docker Toolbox.之后,我在Visual Studio 2017中创建了一个简单的(.Net核心)Web api项目,还启用了Docker支持.

I am working on .Net core Microservices. I installed Docker Toolbox containing docker cli and kitematics. After that i created a simple (.Net core) web api project in visual studio 2017 and also enable docker support.

但是当我按F5键运行该程序时,它显示以下错误并且无法运行.

But when i hit F5 to run the program it shows following error and doesn't run.

Visual Studio容器工具要求Docker在构建,调试或运行容器化项目之前运行.

请查看附件中的图像.

运行项目时出现Visual Studio错误

Visual studio error on running the project

如果我使用docker cli构建并运行项目,则该项目正在运行.问题出在Visual Studio 2017中.

If i build and run the project using docker cli, it's working. The problem is with visual studio 2017.

出现此问题是因为Visual Studio容器无法连接Windows的docker,为此的解决方案是使用以下命令从Docker CLI打开Visual Studio 2017. /c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/Community/Common7/IDE/devenv.exe C:\\PATH\\TO\\MY\\SOLUTION.sln

The problem occurs because Visual studio container is unable to connect to docker for windows and solution for this is to open the visual studio 2017 from Docker CLI using following command. /c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/Community/Common7/IDE/devenv.exe C:\\PATH\\TO\\MY\\SOLUTION.sln

这里:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe

是我的devenv.exe文件和第二个参数的位置

is the location of my devenv.exe file and 2nd parameter

C:\\PATH\\TO\\MY\\SOLUTION.sln

显示解决方案文件的路径.

shows the path of solution file.

有关此解决方案的更多详细信息,请单击

For further details of this solution, click Here.