简体   繁体   English

无法添加 Docker 支持 Visual Studio 2017

[英]Cant add Docker Support Visual Studio 2017

I'm using VS 2017. I have a web service and I want to add docker support to it.我正在使用 VS 2017。我有一个 Web 服务,我想为其添加 docker 支持。 When I right click and open up the menu to add docker support it is greyed out.当我右键单击并打开菜单以添加 docker 支持时,它显示为灰色。 What causes it to be greyed out?是什么导致它变灰? How can I add docker support to my app?如何向我的应用程序添加 docker 支持?

*Side note I went up to the solution and added a new project (web app) and when it's done adding that new project I'm able to add docker support to it but still not able to add support to my other web service. *旁注我找到了解决方案并添加了一个新项目(Web 应用程序),当它完成添加该新项目时,我可以向它添加 docker 支持,但仍然无法向我的其他 Web 服务添加支持。 Also both projects are targeting .net Framework 4.5.2此外,这两个项目都针对 .net Framework 4.5.2

Edit the.csproj file and search for "docker" - remove the following line:编辑 .csproj 文件并搜索“docker”——删除以下行:

<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>

Also delete the file "Dockerfile" which should be in the same folder as the.csproj file.同时删除应该与 .csproj 文件位于同一文件夹中的文件“Dockerfile”。

Try double-checking your.csproj, .sln, and solution and project folders for any references to Docker.尝试仔细检查您的 .csproj、.sln 以及解决方案和项目文件夹中是否有任何对 Docker 的引用。 There have been a few times where I have run into this, usually caused by adding, removing, and trying to re-add Docker support.我遇到过几次这种情况,通常是由于添加、删除和尝试重新添加 Docker 支持引起的。 Clearing out the Dockerfile in the project folder along any other Docker stuff in the solution solved the issue in my case.清除项目文件夹中的 Dockerfile 以及解决方案中的任何其他 Docker 内容解决了我的问题。

That could be because of your solution already contain docker-compose with dockerignore and docker-compose.yml.这可能是因为您的解决方案已经包含带有 dockerignore 和 docker-compose.yml 的 docker-compose。

If you want to add it again, Try to remove it and check.如果你想再次添加它,请尝试将其删除并检查。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM