question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.NET 6: The "CreateAppHost" task failed unexpectedly.

See original GitHub issue

Error when building.

error MSB4018: The "CreateAppHost" task failed unexpectedly.
error MSB4018: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
error MSB4018: File name: 'System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
error MSB4018: The Zone of the assembly that failed was:
error MSB4018: MyComputer
error MSB4018:    at Microsoft.NET.HostModel.AppHost.MachOUtils.RemoveSignature(String filePath)
error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.<>c__DisplayClass2_0.<CreateAppHost>g__RemoveSignatureIfMachO|2()
error MSB4018:    at Microsoft.NET.HostModel.RetryUtil.RetryOnIOError(Action func)
error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String appBinaryFilePath, Boolean windowsGraphicalUserInterface, String assemblyToCopyResorcesFrom)
error MSB4018:    at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore()
error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute()
error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
error MSB4018: 
error MSB4018:

VS: 2019 16.9 Preview 2 .NET SDK: 6.0.100-alpha.1.21057.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:24 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
ericstjcommented, Jan 25, 2021

@rseanhall I unlocked it. Looks like that happened because the bot locked it when it was closed but didn’t unlock when it was reopened. I’ll follow up with the bot owner on that behavior.

1reaction
PylotLightcommented, Feb 26, 2021

@ericstj I found what I think is the latest build from this page: https://github.com/dotnet/installer#installers-and-binaries dotnet-sdk-6.0.100-preview.3.21123.4-win-x64 Getting different errors now at least which is unrelated to this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The CreateAppHost task failed unexpectedly. MSB4018
I was running the code inside shared directory, moving the folder out of shared directory and running the dotnet again solved the error....
Read more >
MSB4018: The task failed unexpectedly - Microsoft Q&A
Hello I have a problem in VS 2022 .net 6. The problem is: MSB4018: The task failed unexpectedly in Microsoft.Net.Sdk.targets line 554
Read more >
The CreateAppHostTask failed unexpectedly
For a while now, I have been receiving an error “The “CreateAppHost” task failed unexpectedly. System.IO.IOException: The process cannot ...
Read more >
Project cant be builded
Hello, i cant build my c# winforms project. it shows this error: Error MSB4018 the "CreateAppHost" task failed unexpectedly. Microsoft.NET.
Read more >
MSBuild forum - RSSing.com
Error MSB4018 The "CreateAppHost" task failed unexpectedly. Microsoft.NET.HostModel.HResultException: 80070013 at Microsoft.NET.HostModel.AppHost.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found