-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add container support? #9
Comments
Do these steps work successfully if trying to use them on an ASP.NET Core application? If this is the case, then it's possible that the Microsoft.NET.Sdk.Web contains something that allows the package to work that Microsoft.NET.Sdk (which this project imports) does not, or, perhaps, Visual Studio itself likes to treat Microsoft.NET.Sdk.Web projects special. If ASP.NET Core applications do not work for you following the steps described, then you likely need to first troubleshoot that problem. If, however, ASP.NET Core applications do work, then we would need to find out what allows the Microsoft.NET.Sdk.Web SDK to work. I have a feeling that, if this is the case, it is likely a |
@fretje
However, as @TheJayMann says - the Launch Profile option for docker seems likely to be lit up via a <ItemGroup>
<ProjectCapability Include="ContainerTargets" />
</ItemGroup>
<PropertyGroup>
<HasContainerTargets>true</HasContainerTargets>
</PropertyGroup> and <ItemGroup>
<ProjectCapability Include="BuildServiceTargets" />
</ItemGroup> Unfortunately I couldn't find any more information on how launchSettings commands were resolved - obviously there is Program, IIS Express and Docker but it is not obvious how these work. It seems as if you can force the issue by creating a folder |
I believe a package (built-in or add-on) supports a launch command via @fretje <ProjectCapability Include="ContainerToolsDebugging" />
<ProjectCapability Include="ContainerTargets" /> |
This lights up the <PropertyGroup>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
</PropertyGroup> |
I am trying to convert an existing NetFramework4.8 (webapi) project to use this new SDK style. This NetFramework project has docker support enabled, and it is possible to build the docker container and debug the application inside the docker container all from visual studio. I actually enabled that support by specifying it while creating the project, but I think that is the same as not specifying it there and then simply adding it afterwards by right clicking on the project and add > docker support. Which is actually available for NetFramework projects even though the docs might state it otherwise. I have created a brand new asp.net mvc (netframework) application and enabled docker support from the get go, just to test this out. This is the "Container Tools" output after creating the project:
Running and debugging the project in Docker works as you would expect. For comparison, I have done the same for an ASP.NET Core Web project, but there everything comes in the "Build" output. There is no "Container Tools" output:
Here also Debugging works fine. Both projects are available here: https://github.com/fretje/DockerSdkStyle I'll try and create a similar sdkstyle project in the same repo and see where I get with some of the suggestions here... |
Adding
Seems to have gotten me further. Now the "Container Tools" output looks promising:
Starting debug build output looks like this:
But then I get an error The project has been added to the test repository... |
@fretje Great to have all 3 types in a repo for comparison. I had pretty much got as far as you, with the same error message. |
I hope not. Writing an IDebugLaunchProvider is no easy task. Most of these errors indicate that some MSBuild property is not set but is expected by the docker package. This could be either because it's in NET.Sdk.Web or some other lightup that would trigger it is still missing. |
Tried this with a simple console app, the only difference was the target framework. Works for net5, same error message for net48. Unfortunately it looks like the |
@bachratyg I've looked through the source of the |
AFAIK the package is not OSS. Where did you get the source? |
I don't think it's developed in the open, but you can download the nupkg from here and extract the target file: https://www.nuget.org/packages/Microsoft.VisualStudio.Azure.Containers.Tools.Targets/ |
Okay, just a heads up: I got a response from an MSFT engineer on the issue I opened with the container tools team (see above):
|
I am looking to try and capture information from the issues into documentation, and while this is an ongoing issue pending some feedback from the docker tools team, I feel it might be useful to capture the current state of the issue as perhaps a known limitation or similar - obviously with a link to this issue. |
@fretje / @CZEMacLeod , are there any updates on this? @CZEMacLeod I see you added the "known limitation" label somewhat recently. Are there any news on this or was that done only because you created the label recently (or forgot to tag it before)? |
As far as I can tell, there seems to be some support in the latest docker container targets, but debugging still fails to automatically attach. |
This is probably something that should be posted to the Visual Studio Team... But maybe someone here can shed some light on this?
I have tried to get container support running on a project created with this sdk, but it doesn't seem to work.
(See here for the official docs on this container support)
I have added a package reference to the container tools:
I have added a Dockerfile and a .dockerignore file.
I have added a profile to the launchsettings:
But when I try to debug or run the project using that profile, I get an error message "the project doesn't know how to run the profile Docker":
The text was updated successfully, but these errors were encountered: