Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

This error just seems to happen randomly. I've done an internet search, but nothing turns up. If I clean out the bin, obj, and .vs directories, it will fix it for a few builds and then the error will come back.

1>------ Build started: Project: GridViewOnly, Configuration: Debug Any CPU ------
1>Failed to check the content hash of the destination ref assembly 'C:Usersmyusersource
eposGridViewOnlyinDebug
et5.0-windows
efGridViewOnly.dll'. It will be overwritten.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(4413,5): error MSB4018: The "CopyRefAssembly" task failed unexpectedly.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(4413,5): error MSB4018: System.InvalidOperationException: The "CopyRefAssembly" task has not registered its resources. In order to use the "TaskLoggingHelper.FormatResourceString()" method this task needs to register its resources either during construction, or via the "TaskResources" property.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(4413,5): error MSB4018:    at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args)
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(4413,5): error MSB4018:    at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation(Boolean condition, String resourceName, Object arg0)
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(4413,5): error MSB4018:    at Microsoft.Build.Utilities.TaskLoggingHelper.FormatResourceString(String resourceName, Object[] args)
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(4413,5): error MSB4018:    at Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorWithCodeFromResources(String messageResourceName, Object[] messageArgs)
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(4413,5): error MSB4018:    at Microsoft.CodeAnalysis.BuildTasks.CopyRefAssembly.Copy()
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(4413,5): error MSB4018:    at Microsoft.CodeAnalysis.BuildTasks.CopyRefAssembly.Execute()
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(4413,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(4413,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>Done building project "GridViewOnly.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
question from:https://stackoverflow.com/questions/65853141/error-msb4018-the-copyrefassembly-task-failed-unexpectedly

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
763 views
Welcome To Ask or Share your Answers For Others

1 Answer

I used the configuration manager to create an x64 configuration and that seems to fix it. I haven't encountered the problem since I did that a couple days ago, anyway. Before, I was just using the default AnyCPU configuration. I wound up deleting it because I know I don't need it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...