visual-studioasp.net-corevisual-studio-2019

The CreateAppHost task failed unexpectedly. MSB4018


When I try and build my ASP.NET Core project, I continue to get this error message in Visual Studio 2019. When I build it the second time, the error disappears.

Does anyone know what this error means and how to get rid of it?

Thanks!

<CreateAppHost AppHostSourcePath="$(AppHostSourcePath)"
                   AppHostDestinationPath="$(AppHostIntermediatePath)"
                   AppBinaryName="$(AssemblyName)$(TargetExt)"
                   IntermediateAssembly="@(IntermediateAssembly->'%(FullPath)')"
                   WindowsGraphicalUserInterface="$(_UseWindowsGraphicalUserInterface)"
                   Retries="$(CopyRetryCount)"
                   RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
                   />

enter image description here


Solution

  • Try running visual studio using 'as administrator' option.

    enter image description here

    Some of the files which required for complete building may need admin privilege for accessing them. Commonly run Visual Studio has not enough rights to access them