Currently targeting DotNetFramework (e.g. net471) and build an ASPNET Core project isn't able to be dockerized, it's disabled in the UI, and if a dcproj and Dockerfile are set up manually then the following error is thrown:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(279,5): error : Value cannot be null.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(279,5): error : Parameter name: stream
And that's because the Microsoft.Docker.Templates.windows.dotnetframework.aspnetcore.docker-compose.vs.debug.yml template doesn't exist in Microsoft.Docker.dll
Currently, for me, moving to .NET Core isn't viable because I have too many, very old dependencies that can't be moved to dotnet core.
I've managed to trick the the dcproj into compiling by adding the following to my project to convince the docker tools it's a console project (by setting the ProjectCapability value to be empty when calling ResolveAppType):
<Import Project="$(MSBuildExtensionsPath)\Sdks\Microsoft.Docker.Sdk\build\Microsoft.Docker.targets" Condition="Exists('$(MSBuildExtensionsPath)\Sdks\Microsoft.Docker.Sdk\build\Microsoft.Docker.targets')" />
<Target Name="DockerResolveAppType">
<ResolveAppType ProjectDirectory="$(MSBuildProjectDirectory)" ProjectCapability="" OutputType="$(OutputType)" ProjectTypeGuids="$(ProjectTypeGuids)">
<Output TaskParameter="AppType" PropertyName="DockerAppType" />
</ResolveAppType>
</Target>
Although this allows me to compile and get the container up with msvsmon.exe running, I still have to docker exec to start the site and manually attach from inside VS, which is a bit of a pain, and from what I can tell it's just because it's only because docker tools trys to check if the project is compatible.
@neoGeneva thanks for reporting, this scenario is not supported at the moment and that's why it is blocked from the UI.
We'll add that work item in our backlog and triage it accordingly.
Great, thanks @haniamr
Any update on this ?
Most helpful comment
Any update on this ?