Hello I am receiving a weird PrepareForLaunch error where it says it's unable to find a copy of NewtonSoft.json
I did not find much in the documentation and I tried deleting and rebuilding the container multiple times. Virtualization is also on for my PC.
ERROR:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
BUILD OUTPUT LOGS:
1>------ Build started: Project: docker-compose, Configuration: Debug Any CPU ------
1>docker-compose -f "C:\TFS\NewDev\ServicesV2\Albany.ListingFileImport\Albany.ListingFileImport\docker-compose.yml" -f "C:\TFS\NewDev\ServicesV2\Albany.ListingFileImport\Albany.ListingFileImport\docker-compose.override.yml" -f "C:\TFS\NewDev\ServicesV2\Albany.ListingFileImport\Albany.ListingFileImport\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose8770880910246019952 --no-ansi up -d --build --force-recreate --remove-orphans
1>Creating network "dockercompose8770880910246019952_default" with the default driver
1>Removing Albany.ListingFileImport.Container
1>Building albany.listingfileimport.container
1>Step 1/7 : FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
1> ---> 8bb9a7097288
1>Step 2/7 : ARG source
1> ---> Using cache
1> ---> 5dfad3c3e484
1>Step 3/7 : WORKDIR /app
1> ---> Using cache
1> ---> 8999bb6d9d5d
1>Step 4/7 : COPY ${source:-obj/Docker/publish} .
1> ---> Using cache
1> ---> 722cc48b105d
1>Step 5/7 : ENTRYPOINT ["C:\app\Albany.ListingFileImport.Container.exe"]
1> ---> Using cache
1> ---> abec9e32d18b
1>Step 6/7 : LABEL com.microsoft.created-by=visual-studio
1> ---> Using cache
1> ---> 943d7149f676
1>Step 7/7 : LABEL com.microsoft.visual-studio.project-name=Albany.ListingFileImport.Container
1> ---> Using cache
1> ---> fd7d4d8ace49
1>Successfully built fd7d4d8ace49
1>Successfully tagged albanylistingfileimportcontainer:dev
1>Recreating d201b46a30b7_Albany.ListingFileImport.Container ...
1>Recreating d201b46a30b7_Albany.ListingFileImport.Container ... error
1>ERROR: for d201b46a30b7_Albany.ListingFileImport.Container Cannot start service albany.listingfileimport.container: container 916c318b9f6ec14f9efbe2b3bb390d2aae94b7d698dfc82e6f863d1b7213175a encountered an error during Start: failure in a Windows system call: The virtual machine or container exited unexpectedly. (0xc0370106)
1>ERROR: for albany.listingfileimport.container Cannot start service albany.listingfileimport.container: container 916c318b9f6ec14f9efbe2b3bb390d2aae94b7d698dfc82e6f863d1b7213175a encountered an error during Start: failure in a Windows system call: The virtual machine or container exited unexpectedly. (0xc0370106)
1>Encountered errors while bringing up the project.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: The "PrepareForLaunch" task failed unexpectedly.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: File name: 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: at Microsoft.Docker.BuildTasks.DockerBuildTask.OutputAndLogContainerToolsException(ContainerToolsException ex)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: at Microsoft.Docker.BuildTasks.DockerBuildTask.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: at Microsoft.Docker.BuildTasks.DockerBuildTask.Execute()
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: WRN: Assembly binding logging is turned OFF.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: Note: There is some performance penalty associated with assembly bind failure logging.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018: To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(386,5): error MSB4018:
1>Done building project "docker-compose.dcproj" -- FAILED.
Hi @kaicianflone I need following details from you to debug this issue -
Hi @kaicianflone ,
The following error lines indicate that the bug you are facing is not Visual Studio or Docker tooling bug, but it is something with your Windows installation.
1>ERROR: for d201b46a30b7_Albany.ListingFileImport.Container Cannot start service albany.listingfileimport.container: container 916c318b9f6ec14f9efbe2b3bb390d2aae94b7d698dfc82e6f863d1b7213175a encountered an error during Start: failure in a Windows system call: The virtual machine or container exited unexpectedly. (0xc0370106)
Can you confirm if you can run any other Windows containers on your machine?
You can check that by executing -
docker pull mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
followed by -
docker run -it mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
If you can't run Windows containers, please update your Windows installation to latest version,
Make sure to install KB4505903 update and check back again.
I have the same problem with VS2019 Enterprise Build 16.6.2.
I have an old Web Services solution that I am trying to dockerize.
Got the same error:
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(384,5): error MSB4018: The "PrepareForLaunch" task failed unexpectedly.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(384,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(384,5): error MSB4018: File name: 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(384,5): error MSB4018: at Microsoft.VisualStudio.Containers.Tools.Common.Prerequisites.DockerForWindowsDriveSharingPrerequisite.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(384,5): error MSB4018: at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.StartTStateMachine
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(384,5): error MSB4018: at Microsoft.VisualStudio.Containers.Tools.Common.Prerequisites.DockerForWindowsDriveSharingPrerequisite.EvaluateAsync(CancellationToken cancellationToken)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(384,5): error MSB4018: at Microsoft.Docker.Prerequisites.DockerForWindowsDriveSharingPrerequisite.
My solution has 2 projects that go into the docker compose. One is plain old WCF and it composed fine. Then I added the 2nd project (System.Web.Services SOAP) manually into the compose yml and now I am getting this issue.
@pratiksanglikar , this is indeed a visual studio enterprise/docker sdk deployment issue.
See
https://github.com/microsoft/DockerTools/issues/254
Started with VS 16.6.5 update.
Severity Code Description Project File Line Suppression State
Error MSB4018 The "PrepareForLaunch" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
at Microsoft.VisualStudio.Containers.Tools.Common.Prerequisites.DockerForWindowsDriveSharingPrerequisite.
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.StartTStateMachine
at Microsoft.VisualStudio.Containers.Tools.Common.Prerequisites.DockerForWindowsDriveSharingPrerequisite.EvaluateAsync(CancellationToken cancellationToken)
at Microsoft.Docker.Prerequisites.DockerForWindowsDriveSharingPrerequisite.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Docker.Prerequisites.DockerCompositePrerequisite.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Docker.BuildTasks.DockerBuildTask.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Docker.BuildTasks.DockerBuildTask.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Docker.BuildTasks.DockerBuildTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
docker-compose C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 384
Restarted Docker.
Stopped all running containers
Removed containers
Removed images
Relaunched via VS, conatiner output indicates that the containers started successfully, But VS fails afterwards.
I copied the docker compose command that VS reportedly used and ran that independently, and saw no issues. All containers started as expected.
@jamescanady is it possible for you to create a sample project to reproduce this issue?
I'm having the same issue here. Since the last comments were 29 days ago I can assume that you've found a solution (or maybe vacationing)? @jamescanady
I would be glad if you post some info about how it went afterwards.
Most helpful comment
Started with VS 16.6.5 update.
Severity Code Description Project File Line Suppression Stated__0.MoveNext()d__3.MoveNext()d__2.MoveNext()d__32.MoveNext()d__30.MoveNext()d__26.MoveNext()
Error MSB4018 The "PrepareForLaunch" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
at Microsoft.VisualStudio.Containers.Tools.Common.Prerequisites.DockerForWindowsDriveSharingPrerequisite.
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.StartTStateMachine
at Microsoft.VisualStudio.Containers.Tools.Common.Prerequisites.DockerForWindowsDriveSharingPrerequisite.EvaluateAsync(CancellationToken cancellationToken)
at Microsoft.Docker.Prerequisites.DockerForWindowsDriveSharingPrerequisite.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Docker.Prerequisites.DockerCompositePrerequisite.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Docker.BuildTasks.DockerBuildTask.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Docker.BuildTasks.DockerBuildTask.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Docker.BuildTasks.DockerBuildTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
docker-compose C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 384
Restarted Docker.
Stopped all running containers
Removed containers
Removed images
Relaunched via VS, conatiner output indicates that the containers started successfully, But VS fails afterwards.
I copied the docker compose command that VS reportedly used and ran that independently, and saw no issues. All containers started as expected.